如果我运行我的注册,我会收到此消息。
<?php
$connection = mysqli_connect('localhost', 'root', 'user');
if (!$connection){
die("Database Connection Failed" . mysqli_error($connection));
}
$select_db = mysqli_select_db($connection, 'test');
if (!$select_db){
die("Database Selection Failed" . mysqli_error($connection));
}
?>
答案 0 :(得分:1)
如果您没有密码,请尝试此操作:
$connection = mysqli_connect('localhost', 'root', '', 'test');
// OR with a P@$$w0rd
$connection = mysqli_connect('localhost', 'root', 'P@$$w0rd', 'test');
mysqli_connect
有四个参数: