Solved

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

Posted on 2007-12-01
6
2,409 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 20

Accepted Solution

by:
steelseth12 earned 500 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

705 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