Edit report at http://bugs.php.net/bug.php?id=53239&edit=1
ID: 53239
User updated by: michaelmunsie at yahoo dot com
Reported by: michaelmunsie at yahoo dot com
Summary: Duplicate Calling of MySQL Query after EXIT
-Status: Open
+Status: Closed
Type: Bug
Package: MySQL related
Operating System: Ubuntu 10.04
PHP Version: 5.3SVN-2010-11-03 (SVN)
Block user comment: N
New Comment:
This bug has been fixed. Simply do not use Yslow 2.1.0 on Linux Ubuntu
10.0.4 in Firefox with Autorun enabled. This will make requests twice
for some strange reason.
Peace of mind at last :)
Previous Comments:
------------------------------------------------------------------------
[2010-11-03 23:03:38] michaelmunsie at yahoo dot com
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 this bug report at http://bugs.php.net/bug.php?id=53239&edit=1