ID: 33544 Updated by: [EMAIL PROTECTED] Reported By: mmokhtar at gmail dot com -Status: Open +Status: Feedback -Bug Type: dBase related +Bug Type: MySQL related Operating System: FreeBSD PHP Version: 4.3.10 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip Previous Comments: ------------------------------------------------------------------------ [2005-07-02 05:08:07] mmokhtar at gmail dot com Description: ------------ I use mysql_query() to execute an insert statement into MySql db (ver 4.0.21). Sometimes the query executes correctly inserting a unique record into the table. Other times it inserts two duplicate records. I've tested this several times, and get this random result...however more duplicate entries than single entry during my tests. Reproduce code: --------------- $host = 'localhost'; $user = 'user'; $pass = 'pass'; $db = 'db'; //$selected_prj = $_GET['prjID']; $formsubmit = 0; $formsubmit = $_POST['formsubmit']; $conn = mysql_connect($host, $user, $pass) or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ($db, $conn) or die("Couldn't access database $db on MySQL server $host: ".mysql_error()); if ($formsubmit == '1'){ $queryInsert = "Insert into prjs (prjOwnerID, prjAssignedTo, prjTypeID, prjName, prjDescription, prjComments, prjStatusID, startDate, endDate, CreateDate, LastUpdate) Values (" . $_POST['ClientID'] . ", " . $_POST['AssignedToID'] . ", " . $_POST['prjTypeID'] . ", '" . $_POST['prjName'] . "', '" . $_POST['prjDescription'] . "', '" . $_POST['prjComments'] . "', " . $_POST['prjStatusID'] . ",'" . $prj_StartDate . "', '" . $prj_EndDate . "', now(), now())"; if(!($Result = mysql_query($queryInsert))){ // get error and error number $errno = mysql_errno($conn); $error = mysql_errno($conn); print("Error $errno: $error<br>\n"); } else{ print("<script language=\"javascript\"> "); print("window.opener.location='./myaccount.php'; "); print("self.close();"); print("</script>"); } } Expected result: ---------------- Record is inserted, opening window gets refreshed and current window is closed. Actual result: -------------- two Records are inserted, opening window gets refreshed and current window is closed. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33544&edit=1
