Forum Moderators: coopster
$lookup = mysql_query("...");
$num = mysql_num_rows($lookup);
if($num) {
do stuff...
}
It's worked fine before, but now I get this:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /path_to_file on line #
It works if the query returns something, of course...
if($lookup) {
...
}
Or are there times when $lookup will be set to something, but still not return any rows? If so, I guess I could just do:
if($lookup && mysql_num_rows($lookup)) {
...
}
It's just that it's worked before. You can even find examples on php.net and mysql.com that suggest that method...
$lookup = mysql_query("..."); $num = mysql_num_rows($lookup);
$lookup = mysql_query("...");[/
if($lookup && mysql_num_rows($lookup)) {
...
}