Solved

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

Posted on 2007-12-01
6
2,374 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
  • 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

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…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now