测试 PHP 连接 MySQL

2016-09-19  本文已影响87人  43daf5f8181f
<?php
$dbname = "testphp";
$password = 'allen_8pw';
$servername = 'localhost';
$username = 'allen';

if (!function_exists('mysqli_init') && !extension_loaded('mysqli')) {
    echo 'do not have mysqli!!!!';
} else {
    echo 'have it!!!';
};

$conn = new mysqli($servername, $username, $password);

if ($conn->connect_error) {
    die('Connection failed:' . $conn->connect_error);
}
echo 'Connected successfully';
?>
上一篇下一篇

猜你喜欢

热点阅读