|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
New to the forum and this question could really span multiple sections. I have been having problems with a form which inserts rows into a mySQL database table. Initially, the form appeared to be submitting the information twice (only one click on the submit button) resulting in two rows of the same information being inserted into the table. I remedied this by removing <form> tags from around a "Close" button I had included in the "action" script because all it did was close a spawned window. Basically all the action script did was check the valued entered and either displayed an error message or displayed a success message and then inserted ONE row of information into the table. Removing the form tags from around the close button solved this problem. Weird but nonetheless it worked.
I am now faced with similar problem. The code below results in two rows being inserted ... if ($_POST['osqrate']) { $osqrate = $_POST['osqrate']; $osqid = $_POST['osqid']; if ($uid) { $tuid = $uid; } else { $tuid = $_SERVER['REMOTE_ADDR']; } $db = connect2db(); // Add user's rating $sql = "insert into ratings (rid,qid,uid,rating) values (NULL,$osqid,'$tuid',$osqrate)"; $query = mysql_query($sql); echo mysql_error(); } Two php scripts are included for the udf connect2db() and various other functions/classes but that is the only code that executes relative to the table in the db. I am getting two rows. I have searched and searched but have found no information on others experiencing this same problem. A reference to a similar post, if there is one, is appreciated or guidance on what may be going awry. TIA |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Duplicate Rows Inserted |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|