By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,712 Members | 2,116 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,712 IT Pros & Developers. It's quick & easy.


P: 11
I am gettting a warning mess for mysqli_free_result() function.
In my prog i am trying to get the data from my database, I am getting the desired output but its giving the following warning mess. And also i am posting a part of prog also.
I am using Ubunthu 8.04 LTX

Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in.

Expand|Select|Wrap|Line Numbers
  1. $update_stock_query = "update Stock set
  2.             Quantity='$Stock_Quantity' where
  3.             Book_code='$Book_code'";
  4.         $update_stock_result = $db->query($update_stock_query);        
  6.         if($update_stock_result)
  7.         {
  8.             echo 'Stock and Sales Details updated<br/>';
  9.                  mysqli_free_result($update_stock_result);
  10.         }
  11.                  mysqli_free_result($stock_result);
Aug 25 '08 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 5K+
P: 8,639
what I can see in the code is, that $stock_result is nowhere defined. furthermore I see 1 query and 2 calls to free a result, so maybe it helps to remove that line. You might look at $stock_result with var_dump().
Aug 25 '08 #2

Expert 5K+
P: 5,058

The mysqli_free_result function expects a mysqli_result object as it's parameter.
Note that only mysqli_query calls using SELECT, SHOW, DESCRIBE or EXPLAIN queries will return such an object.
Any other type of query (including UPDATE) will return a boolean result, which does not need, and should not be, freed using the mysqli_free_result function.
Aug 25 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.