<分区>
if(mysql_num_rows($result))
{
echo "no match found!";
}
它抛出一个错误-
警告:mysql_num_rows():提供的参数不是第 72 行 D:\Hosting\6448289\html\includes\getQuestion.php 中的有效 MySQL 结果资源
<分区>
if(mysql_num_rows($result))
{
echo "no match found!";
}
它抛出一个错误-
警告:mysql_num_rows():提供的参数不是第 72 行 D:\Hosting\6448289\html\includes\getQuestion.php 中的有效 MySQL 结果资源
最佳答案
你需要检查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.
如果 mysql_query
失败,它返回 boolean
false
而不是 resource
。
当您将此 boolean
值传递给 mysql_num_rows
时,您会收到此错误。
关于php - mysql_num_rows() : supplied argument is not a valid MySQL result resource,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3698740/