運行報錯: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()函數(shù),我用var_dump函數(shù),發(fā)現(xiàn)$result是一個布爾型的,所以報錯。這是什么原因
<?php
$link = mysql_connect('localhost', '', '') or die('數(shù)據(jù)庫連接失敗');
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);
?>
2017-06-02
把yonghuming ?改成 * 試試