Home  >  Article  >  Backend Development  >  Warning: mysql_fetch_array():_PHP教程

Warning: mysql_fetch_array():_PHP教程

WBOY
WBOYOriginal
2016-07-13 10:52:27793browse

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

$connect=mysql_connect("localhost","root","123") or die("Unable to connect to database".mysql_error());


mysql_select_db("cmstest") or die("Unable to select database".mysql_errno());


$sql="select * from article where pid=1";
$result=mysql_query($sql,$connect) or die("Unable to query sql statement".mysql_error());
$nums=mysql_num_rows($result);
echo "nums is:".$nums;
while($res=mysql_fetch_array($result)){
echo $res[0];
}

It turns out that $result is repeated.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632485.htmlTechArticleWarning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in $connect=mysql_connect(localhost,root ,123) or die(Unable to connect to database.mysql_error()); mysq...
Statement:
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