ID: 37732 Updated by: [EMAIL PROTECTED] Reported By: jerry dot walsh at gmail dot com -Status: Open +Status: Bogus Bug Type: MySQLi related Operating System: FreeBSD 6.1-STABLE PHP Version: 5.1.4 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php when using mysqli_multi_query you always have to process the resultsets before sending a new statement to the server. Even if there is NO resultset (for non SELECT/SHOW/DESRIBE statements) you have to do that to obtain errorcodes for the single statements. Previous Comments: ------------------------------------------------------------------------ [2006-06-07 16:18:55] jerry dot walsh at gmail dot com This will create the table structure: DROP TABLE IF EXISTS `billingrecurringinvoice`; CREATE TABLE `billingrecurringinvoice` ( `billingrecurringinvoice_id` int(10) unsigned NOT NULL auto_increment, `billingrecurringinvoice_currencyid` int(10) unsigned NOT NULL, `billingrecurringinvoice_status` enum('ACTIVE','PENDING_APPROVAL') NOT NULL, `billingrecurringinvoice_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, PRIMARY KEY (`billingrecurringinvoice_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `billingrecurringinvoicedetail`; CREATE TABLE `billingrecurringinvoicedetail` ( `billingrecurringinvoicedetail_id` int(10) unsigned NOT NULL auto_increment, `billingrecurringinvoicedetail_billingrecurringinvoiceid` int(10) unsigned default NULL, `billingrecurringinvoicedetail_productid` int(10) unsigned default NULL, `billingrecurringinvoicedetail_quantity` int(10) unsigned NOT NULL, `billingrecurringinvoicedetail_dontrecur` tinyint(3) unsigned NOT NULL default '0', `billingrecurringinvoicedetail_description` char(255) default NULL, `billingrecurringinvoicedetail_price` float default NULL, PRIMARY KEY (`billingrecurringinvoicedetail_id`), KEY `IX_productfilesearch` (`billingrecurringinvoicedetail_billingrecurringinvoiceid`,`billingrecurringinvoicedetail_productid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; ------------------------------------------------------------------------ [2006-06-07 16:13:38] jerry dot walsh at gmail dot com Description: ------------ Calling mysqli_multi_query with multiple insert queries causes subsequent calls to mysqli_query or mysqli_multi_query to fail with a MySQL lost connection to server (err#2031). OS - FreeBSD 6.1 MySQL - 5.0.22 (also tested on 5.0.18) PHP - 5.1.4 MySQLi version - 5.1.4 Reproduce code: --------------- $strTestDatabaseName = "Testdb"; $db_hostname = "localhost"; $db_username = "username"; $db_password = "password"; $m_mysqlTestConn = mysqli_connect($db_hostname, $db_username, $db_password, $strTestDatabaseName); // succeeds... $strSQL="INSERT INTO billingrecurringinvoicedetail (billingrecurringinvoicedetail_quantity, billingrecurringinvoicedetail_dontrecur) VALUES (1,false);INSERT INTO billingrecurringinvoicedetail (billingrecurringinvoicedetail_quantity, billingrecurringinvoicedetail_dontrecur) VALUES (1,false);"; mysqli_multi_query($m_mysqlTestConn, $strSQL) || print ("Database insert Failed:<br>".mysqli_error($m_mysqlTestConn)." Code:".mysqli_errno ($m_mysqlTestConn)); $strSQL="SELECT * FROM billingrecurringinvoice WHERE billingrecurringinvoice_id = 429;"; // fails (mysqli_multi_query($m_mysqlTestConn, $strSQL)) || print ("Database select Failed:<br>".mysqli_error($m_mysqlTestConn)." Code:".mysqli_errno ($m_mysqlTestConn)); $mysql_result = mysqli_store_result($m_mysqlTestConn); mysqli_close($m_mysqlTestConn); Expected result: ---------------- I expected the select to work after the double insert Actual result: -------------- This line fails: $strSQL="SELECT * FROM billingrecurringinvoice WHERE billingrecurringinvoice_id = 429;"; // fails (mysqli_multi_query($m_mysqlTestConn, $strSQL)) || print ("Database select Failed:<br>".mysqli_error($m_mysqlTestConn)." With: Database select Failed: Lost connection to MySQL server during query Code:2013 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37732&edit=1