From: Operating system: Ubuntu 10.04 PHP version: 5.3SVN-2010-11-03 (SVN) Package: MySQL related Bug Type: Bug Bug description:Duplicate Calling of MySQL Query after EXIT
Description: ------------ Using mysql_query and typing "exit" after the call is resulting in duplicate queries. If you take "exit" off the end of the code, the query will be executed only once as it should. $host = "localhost"; $user = "root"; $password = "password"; $databasename = "databasename"; $connection=mysql_connect ($host, $user, $password) or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db($databasename); $sql = "INSERT INTO table(field, field2, field3) VALUES('value1', 'value2', 'value3')"; $result = mysql_query($sql,$connection) or die ('Database error: ' . mysql_error()); exit; // take this off and the call is executed once Test script: --------------- $host = "localhost"; $user = "root"; $password = "password"; $databasename = "databasename"; $connection=mysql_connect ($host, $user, $password) or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db($databasename); $sql = "INSERT INTO table(field, field2, field3) VALUES('value1', 'value2', 'value3')"; $result = mysql_query($sql,$connection) or die ('Database error: ' . mysql_error()); exit; // take this off and the call is executed once -- Edit bug report at http://bugs.php.net/bug.php?id=53239&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53239&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53239&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53239&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=53239&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53239&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=53239&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=53239&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=53239&r=needscript Try newer version: http://bugs.php.net/fix.php?id=53239&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=53239&r=support Expected behavior: http://bugs.php.net/fix.php?id=53239&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=53239&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=53239&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=53239&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53239&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=53239&r=dst IIS Stability: http://bugs.php.net/fix.php?id=53239&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=53239&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=53239&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=53239&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=53239&r=mysqlcfg