mysqli_free_result()

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vivekshekar
    New Member
    • Jul 2008
    • 11

    mysqli_free_result()

    Hi,
    I am gettting a warning mess for mysqli_free_res ult() 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_res ult() expects parameter 1 to be mysqli_result, boolean given in.



    [code=php]
    $update_stock_q uery = "update Stock set
    Quantity='$Stoc k_Quantity' where
    Book_code='$Boo k_code'";
    $update_stock_r esult = $db->query($update_ stock_query);

    if($update_stoc k_result)
    {
    echo 'Stock and Sales Details updated<br/>';
    mysqli_free_res ult($update_sto ck_result);
    }
    mysqli_free_res ult($stock_resu lt);[/code]
    Last edited by pbmods; Aug 25 '08, 11:02 AM. Reason: Added CODE tags.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    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().

    Comment

    • Atli
      Recognized Expert Expert
      • Nov 2006
      • 5062

      #3
      Hi.

      The mysqli_free_res ult 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_res ult function.

      Comment

      Working...