mysql_fetch_array() expects parameter 1 to be resource, boolean given in D:何解?解决办法

WBOY
Release: 2016-06-13 13:31:06
Original
1089 people have browsed it

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'

这样的错误该怎么改呢?
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template