| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2005-07-20 16:08 UTC] tony2001@php.net
  [2005-07-28 01:00 UTC] php-bugs at lists dot php dot net
  [2008-02-27 19:41 UTC] chedi dot toueiti at gmail dot com
  | 
    |||||||||||||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 04:00:01 2025 UTC | 
Description: ------------ When the result of a statement isn't freed PHP gives an error when trying to issue a new query. It doesn't so when the new query is preparing a statement (see reproduce code). Then mysqli::errno and mysqli::error are empty. workaround: use $stmt to decide wheter $stmt = $mysqli->prepare(...) worked not $mysqli->errno. Reproduce code: --------------- <?php $my = new mysqli("localhost","user","password","db"); $stmta = $my->prepare("SELECT * FROM cms_Site"); $stmta->execute(); $stmtb = $my->prepare("SELECT * FROM cms_Site"); if ($stmtb) { echo "prepare succeeded"; } else { echo "prepare failed<br />"; echo "errno: ", $my->errno, " - error: ", $my->error, "<br />"; } $x = $my->query("") or die("errno: ".$my->errno." - error: ".$my->error."<br />"); ?> Expected result: ---------------- prepare failed errno: 2014 - error: Commands out of sync; you can't run this command now errno: 2014 - error: Commands out of sync; you can't run this command now Actual result: -------------- prepare failed errno: 0 - error: errno: 2014 - error: Commands out of sync; you can't run this command now