mysql_fetch_array() expects parameter 1 to be resource, boolean given in D:何解?解决办法
程序员文章站
2022-05-20 13:34:15
...
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);
?>
------解决方案--------------------
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);
?>
------解决方案--------------------
相关文章
相关视频
上一篇: PHP中DIRECTORY_SEPARATOR的作用
下一篇: php正则表达匹配中文问题分析小结
推荐阅读
-
mysql_fetch_array() expects parameter 1 to be resource, boolean given in D:何解?解决办法
-
php提示异常 mysql_fetch_array() expects parameter 1 to be resource, boolean given
-
mysql_fetch_array() expects parameter 1 to be resource, boolean given in D:何解?解决办法
-
php提示错误 mysql_fetch_array() expects parameter 1 to be resource, boolean given
-
这个警告不知道如何解决mysql_fetch_array() expects parameter 1 to be resource
-
php提示错误 mysql_fetch_array() expects parameter 1 to be resource, boolean given
-
mysql_fetch_array() expects parameter 1 to be resource, boolean given in D:何解?解决办法
-
php提示异常 mysql_fetch_array() expects parameter 1 to be resource, boolean given
-
这个警告不知道如何解决mysql_fetch_array() expects parameter 1 to be resource
-
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given i解决办法