Jump to content

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?
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.