Home > php教程 > php手册 > Warning: mysql_fetch_array():

Warning: mysql_fetch_array():

WBOY
Release: 2016-05-25 16:53:35
Original
1066 people have browsed it

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

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

原来是$result重复了.


教程地址:

欢迎转载!但请带上文章地址^^

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template