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
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
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
Share on other sites

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.