Warning: mysql_fetch_array():

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in

  1. $connect=mysql_connect("localhost","root","123") or die("无法连接数据库".mysql_error());
  2. mysql_select_db("cmstest") or die("无法选择数据库".mysql_errno());
  3. $sql="select * from article where p;
  4. $result=mysql_query($sql,$connect) or die("无法查询sql语句".mysql_error());
  5. $nums=mysql_num_rows($result);
  6. echo "nums is:".$nums;
  7. while($res=mysql_fetch_array($result)){
  8. echo $res[0];
  9. }

原来是$result重复了.