运行报错:Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in D:\Demo\Project01\index.php on line 15。。意思是$result应该要作为资源类型传入mysql_fecth_assoc()函数,我用var_dump函数,发现$result是一个布尔型的,所以报错。这是什么原因
<?php
$link = mysql_connect('localhost', '', '') or die('数据库连接失败');
mysql_select_db('MyHotel');
mysql_query("set names 'utf8'");
$result = mysql_query('select YongHuMing from Customer limit 1');
var_dump($result);
$row = mysql_fetch_assoc($result);
print_r($row);
?>