buconine Posted December 5, 2006 Share Posted December 5, 2006 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 resourcefor 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? Quote Link to comment https://forums.phpfreaks.com/topic/29479-mysql_num_rows-not-valid-argument/ Share on other sites More sharing options...
fert Posted December 5, 2006 Share Posted December 5, 2006 that error means your not connected to a database or your query isn't working. Quote Link to comment https://forums.phpfreaks.com/topic/29479-mysql_num_rows-not-valid-argument/#findComment-135289 Share on other sites More sharing options...
HuggieBear Posted December 5, 2006 Share Posted December 5, 2006 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.RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/29479-mysql_num_rows-not-valid-argument/#findComment-135423 Share on other sites More sharing options...
buconine Posted December 7, 2006 Author Share Posted December 7, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/29479-mysql_num_rows-not-valid-argument/#findComment-136572 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.