运行代码报错
$con = mysql_connect('127.0.0.1', 'root', 'root') or die('数据库连接失败');
if (!$con){
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db("test_db",$con);
mysql_query("set names 'utf8'");
$sql = "SELECT * from Person WHERE Lastname='Adams'";
$result = mysql_query($sql,$con);
print_r(mysql_fetch_assoc($result));
报错如下:
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in D:\phpStudy\WWW\test\test.php on line 11