Jump to content

mysql error


figa11

Recommended Posts

I never have written php or mysql, I usually just buy the sites and upload them. Can someone please tell me why I'm getting this error?

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/figa11/public_html/investments/index.php on line 49

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/figa11/public_html/investments/dailyroutine.php on line 30

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/figa11/public_html/investments/dailyroutine.php on line 70

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/figa11/public_html/investments/dailyroutine.php on line 152

Link to comment
https://forums.phpfreaks.com/topic/216518-mysql-error/
Share on other sites

You have failing queries. mysql_query() returns a resource or a boolean false - the error is telling you that you trying to pass a failed query result into mysql_num_rows() which expects a mysql result resource.

 

You need to perform a check before passing a mysql_query(), something of the form

 

$result = mysql_query(...);
if($result) {
    //use result in mysql_num_rows or any other relevant function
} else {
    // debug / log error using mysql_error()
}

Link to comment
https://forums.phpfreaks.com/topic/216518-mysql-error/#findComment-1125042
Share on other sites

You have failing queries. mysql_query() returns a resource or a boolean false - the error is telling you that you trying to pass a failed query result into mysql_num_rows() which expects a mysql result resource.

 

You need to perform a check before passing a mysql_query(), something of the form

 

$result = mysql_query(...);
if($result) {
    //use result in mysql_num_rows or any other relevant function
} else {
    // debug / log error using mysql_error()
}

 

Am i supposed to add that code somewhere inside the code on my site

Thanks very much for your response

Link to comment
https://forums.phpfreaks.com/topic/216518-mysql-error/#findComment-1125044
Share on other sites

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.