Note that there are some explanatory texts on larger screens.

plurals
  1. POmysqli_free_result(): Object of class mysqli_result could not be converted to string
    text
    copied!<p>As far as I've done my searchings over Google and everything, it looks like this is a pretty common issue, but I cannot seem to fix it. Plus, I think that I have a little different usage of the function as others out there. And, after about 3 hours of no luck, I'm posting here!</p> <pre><code>function free_result(){ # LINE 48 $free = "SELECT SHOW DESCRIBE EXPLAIN"; # LINE 49 $free = explode(" ", $free); # LINE 50 $sql = $this-&gt;sql; # LINE 51 while(list($key, $value) = each($free)){ # LINE 52 if(preg_match("/\b".$value."\b/", $sql)){ # LINE 53 $result = $this-&gt;result; # LINE 54 if(!mysqli_free_result($result)){ # LINE 55 $this-&gt;errors("Invalid result: &lt;b&gt;{$result}&lt;/b&gt;. Couldn't free result."); # LINE 56 } # LINE 57 } # LINE 58 } # LINE 59 } # LINE 60 # LINE 61 function query($sql){ # LINE 62 $this-&gt;query_id = mysqli_query($this-&gt;connection, $sql); # LINE 63 $this-&gt;result = mysqli_store_result($this-&gt;connection); # LINE 64 $this-&gt;sql = $sql; # LINE 65 if(!$this-&gt;query_id){ # LINE 66 $this-&gt;errors("Couldn't query: &lt;b&gt;{$sql}&lt;/b&gt;"); # LINE 67 return 0; # LINE 68 } # LINE 69 $this-&gt;affected = mysqli_affected_rows($this-&gt;connection); # LINE 70 # LINE 71 return $this-&gt;query_id; # LINE 72 } # LINE 73 </code></pre> <p>These are 2 of the functions which are within my database class. But I think only these 2 are needed for resolving the issue.</p> <p>So, the error I'm recieving is:</p> <pre><code>"Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in [file path]\database.class.php on line 55" #followed by my database class error handling "Invalid result: . Couldn't free result." </code></pre> <p>As far as my understanding about this goes, I think that the problem is with <strong>$result</strong> variable (LINE 54, LINE 64), but because this is my first adventure with MySQLi then I'm not quite sure.</p> <p>I hope you understand the issue and will be able to help! Thanks in advance!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload