ID: 27920 Comment by: orlov_oleg at hotmail dot ru Reported By: klaus dot kuehne at gga-hannover dot de Status: No Feedback Bug Type: MSSQL related Operating System: Win 2000 Server PHP Version: 4.3.5 New Comment:
Yes, this bug exist in PHP 5.0.4 also yesterday I detect bug. this bug very strange. $res = mysql_query("insert into page_sql (name) values('ZANUSSI')") or die("Query failed : " . mysql_error()); $id = mysql_insert_id(); insert one time; execute then any "select" "insert" again executed; sorry for my English Orlov Oleg. Previous Comments: ------------------------------------------------------------------------ [2004-04-12 17:54:07] [EMAIL PROTECTED] No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. ------------------------------------------------------------------------ [2004-04-08 16:01:59] [EMAIL PROTECTED] mssql_query() does not do anything to the SQL statement, other than passing it on to the SQL server (once). There is no code to resubmit the same statement. The SQL statement can be a batch of inserts and or other commands, and mssql_query() will return false if one statement fails to execute on the server. A true value is returned if everything was executed with success but no data sets were returned (INSERT, UPDATE and DELETE statements). If a single statement returns a recordset mssql_query() will return a reource handle for the data. I think this is a bug in either your PHP code or in the SQL statements (batches) you are sending to the server. Can you please provide some more info woth some code that reproduces the error. ------------------------------------------------------------------------ [2004-04-08 11:19:31] [EMAIL PROTECTED] Huh? How can this be PHP bug? ------------------------------------------------------------------------ [2004-04-08 09:16:26] klaus dot kuehne at gga-hannover dot de Description: ------------ Depending of database and/or network charge, a single INSERT may be executed more than one time by mssql_query(), even if the first INSERT was executed successfully. The return code of mssql_query will be set to the last executed INSERT. In my case, a unique index prevented the subsequent INSERT's. This caused a lot of confusion, because the first INSERT was completed successful and mssql_query("INSERT INTO ...", $con) delivered "false" nevertheless. Problably, a longer delay time will be misinterpreted as a database lock, and mssql_query tries to encounter this by repetitions of the same INSERT. Couldn't find any workaround for this. I recognized this bug in PHP versions 4.3.2 - 4.3.5. Expected result: ---------------- A succesful INSERT may not be repeated. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27920&edit=1