• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2465
  • Last Modified:

php warning: mysql_free_result(): supplied argument is not a valid MySQL result

I keep getting this warning in a phpbb2 script after adding a mod (i must say that this file hasn't been edited)

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /mounted-storage/home43a/sub004/sc31952-BMDX/www/forum/db/mysql4.php on line 319

This is the code in that line of the file:

            if ( $query_id )
            {
                  unset($this->row[$query_id]);
                  unset($this->rowset[$query_id]);

                  mysql_free_result($query_id); //line 319

                  return true;
            }
            else
            {
                  return false;
            }
      }

How can i fix this??

When i print the content of the variable $query_id I get  this "Resource id #351"
0
axtur
Asked:
axtur
  • 2
  • 2
  • 2
1 Solution
 
nizsmoDeveloperCommented:
try and track down where $query_id is declared, and see if it is a connection link to mysql database.

You can temporarily suppress the error message:
@mysql_free_result($query_id);

but off course, you should fix up the error if possible.
0
 
axturAuthor Commented:
It is in this function:


      function sql_freeresult($query_id = 0)
      {
            if( !$query_id )
            {
                  $query_id = $this->query_result;
            }

            if ( $query_id )
            {
                  unset($this->row[$query_id]);
                  unset($this->rowset[$query_id]);
                  mysql_free_result($query_id);

                  return true;
            }
            else
            {
                  return false;
            }
      }
0
 
nizsmoDeveloperCommented:
This may be relevant to your problem:
http://www.opentools.de/archive/index.php?t=5330

PLease try and see if this helps.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
steelseth12Commented:
try this
function sql_freeresult($query_id = 0)
      {
            if( !$query_id )
            {
                  $query_id = $this->query_result;
            }
 
            if ( $query_id )
            {
                  unset($this->row[$query_id]);
                  unset($this->rowset[$query_id]);
                 
				 if(is_resource($query_id)) {
				 
				  mysql_free_result($query_id);
				
				}
                  return true;
            }
            else
            {
                  return false;
            }
      }

Open in new window

0
 
steelseth12Commented:
the @mysql_free_result( suggested by nizsmo only hides the error .
The above solves the problem .
0
 
axturAuthor Commented:
Solved, great answer, it also helped me solve another problem.
Thank you!!!
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now