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];
}
原來是$result重復了.