当前位置:Gxlcms > PHP教程 > mysql_fetch_array()expectsparameter1toberesource,booleangiveninD:何解?解决办法

mysql_fetch_array()expectsparameter1toberesource,booleangiveninD:何解?解决办法

时间:2021-07-01 10:21:17 帮助过:16人阅读

mysql_fetch_array() expects parameter 1 to be resource, boolean given in D:何解?
mysql_fetch_array() expects parameter 1 to be resource, boolean given in D:\xampp\htdocs\4.php on line 12

请问是什么错误?如何改正?谢谢大家啊~

代码如下:

$con = mysql_connect("localhost","root ","");
//通过服务器locahost建立连接,用户名为root,无密码

if (!$con)
{
die('Could not connect: ' . mysql_error());
}//如果不成功,显示错误
mysql_select_db("crms", $con);//选择数据库
$result = mysql_query("SELECT * FROM Cno");//查找

while($row = mysql_fetch_array($result))//打印
{
echo $row['Cno'] . " " . $row['Cno'];
echo "
";
}

mysql_close($con);
?>

------解决方案--------------------
探讨

Access denied for user ''@'localhost' to database 'crms'

这样的错误该怎么改呢?

人气教程排行