开发者

mysql_num_rows(): supplied argument is not a valid MySQL result resource [duplicate]

开发者 https://www.devze.com 2023-01-16 02:42 出处:网络
This questio开发者_开发知识库n already has answers here: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result [duplicate]
This questio开发者_开发知识库n already has answers here: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result [duplicate] (6 answers) Closed 9 years ago.
if(mysql_num_rows($result))
{
echo "no match found!";
}

it is throwing an error- Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in D:\Hosting\6448289\html\includes\getQuestion.php on line 72


You need to check the return value of mysql_query

$query = 'YOUR QUERY';
$result = mysql_query($query);
if (!$result) {
    trigger_error('Invalid query: ' . mysql_error()." in ".$query);
}
// go ahead and fetch the results using mysql_num_rows.

If mysql_query fails it returns boolean false instead of a resource.

When you pass this boolean value to mysql_num_rows you get this error.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号