数据库连接代码:
$server="localhost";
$username="root";
$password="";
$database="library";
$conn=mysqli_connect($server,$username,$password);
if (!$conn) {
die("mysqli_connect failed".mysql_error());
}
$db_selected = mysql_select_db($database,$conn);
if (!$db_selected) {
die("select db error:".mysql_error());
}
连接是返回提示:select db error:
这是为什么啊,使用navicat可以连到library数据库的。
怪我咯2017-04-11 09:07:56
$db_selected = mysql_select_db($database,$conn);
改成 $db_selected = mysqli_select_db($database,$conn);
没错,你把mysqli写成了mysql