1
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

codaddict
  • 445,704
  • 82
  • 492
  • 529
ppp
  • 259
  • 2
  • 8
  • 11
  • It is the error of mysql_query(), Please check this or check select query also.... – Karthik Sep 13 '10 at 08:16
  • LOL no, the code *after* this line is not needed :) Although no need to show any code. the problem is clear. You have an error while query execution. Use codaddict's code to see what error you experience. – Your Common Sense Sep 13 '10 at 08:28

1 Answers1

5

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.

Your Common Sense
  • 156,878
  • 40
  • 214
  • 345
codaddict
  • 445,704
  • 82
  • 492
  • 529