Jump to content

mysql_num_rows - not valid argument


buconine

Recommended Posts

running php 4.4.4

i am getting errors with my cron.
the error is: Warning:  mysql_num_rows(): supplied argument is not a valid MySQL result resource
for this line of code: if (mysql_num_rows($result) > 0) {
being used in a select statement which in my books should be a legal statement.

is this a php5 or better statement?

any ideas?
Link to comment
https://forums.phpfreaks.com/topic/29479-mysql_num_rows-not-valid-argument/
Share on other sites

My advice would be to echo your code for the previous mysql query as the problem isn't with the call to [color=green]mysql_num_rows()[/color] it's actually more than likely with [color=green]mysql_query()[/color].  You probably have something like this:

[code=php:0]$result = mysql_query("SELECT column_name FROM table_name");[/code]

try changing to this:

[code=php:0]
$sql = "SELECT column_name FROM table_name";
$result = mysql_query($sql);
if (!$result){
  echo "Couldn't execute query: $sql\n\n" . mysql_error();
}
[/code]

This will tell you why your result isn't valid.

Regards
Huggie
i had an == instead of a = in my select statement.

i appreciate the help!

next dumb question, my cron is working great, but it is sending out emails to the same people repeatedly. is there any way to make it only send that user 1 email and skip them next time it runs?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.