[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2007-12-01
6
Medium Priority
?
2,442 Views
Last Modified: 2013-12-12
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
Comment
Question by:axtur
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 21

Expert Comment

by:nizsmo
ID: 20390120
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
 

Author Comment

by:axtur
ID: 20390137
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
 
LVL 21

Expert Comment

by:nizsmo
ID: 20390155
This may be relevant to your problem:
http://www.opentools.de/archive/index.php?t=5330

PLease try and see if this helps.
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
LVL 20

Accepted Solution

by:
steelseth12 earned 2000 total points
ID: 20390341
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
 
LVL 20

Expert Comment

by:steelseth12
ID: 20390376
the @mysql_free_result( suggested by nizsmo only hides the error .
The above solves the problem .
0
 

Author Closing Comment

by:axtur
ID: 31412156
Solved, great answer, it also helped me solve another problem.
Thank you!!!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question