FW: When inserting data it insert 2 records one correct and one blank!
sending on to list while I think... ;) -Original Message- From: Emilio Ruben Estevez [mailto:[EMAIL PROTECTED] Sent: Thursday, October 09, 2003 10:34 AM To: Dan Greene Subject: RE: When inserting data it insert 2 records one correct and one blank! Ok, here it is the full statement: $sql = INSERT INTO llamadas (destinatario,fecha,hora,apellido,nombre,telefono,mail,receptor,mensaje) VALUES ('$destinatario','$fecha','$hora','$apellido','$nombre','$telefono','$mail','$receptor','$mensaje'); $result = mysql_query($sql); And, yes it happens to all users, and i ve tested pressing only once the submit button but i allways got 2 records add the first one is a blank one and the second the correct one. From: Dan Greene [EMAIL PROTECTED] To: Emilio Ruben Estevez [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: When inserting data it insert 2 records one correct and one blank! Date: Thu, 9 Oct 2003 10:09:00 -0400 Emilio, Can you supply the full insert statement? Also, is this happening for all users, or one in particular? I ask, as I've seen issues with web app users double-clicking the submit button causing similar issues -Original Message- From: Emilio Ruben Estevez [mailto:[EMAIL PROTECTED] Sent: Thursday, October 09, 2003 10:02 AM To: [EMAIL PROTECTED] Subject: When inserting data it insert 2 records one correct and one blank! Hi, I have a page on a intranet where workers can insert data into a database, the thing is that when they type the info an press submit the page use the INSERT INTO db then when i check the data in the database i can see the record that the user entered and a second record that is all in blank, exept for the date and time field that the value is -00-00 and 00:00:00. What´s wrong? maybe something of the date and time format?? Any Clue. Thanks. Emilio. _ Add MSN 8 Internet Software to your existing Internet access and enjoy patented spam protection and more. Sign up now! http://join.msn.com/?page=dept/byoa -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] _ High-speed Internet access as low as $29.95/month (depending on the local service providers in your area). Click here. https://broadband.msn.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: FW: When inserting data it insert 2 records one correct and one blank!
are you doing this insert in any sort of loop? if you emailed yourself the final query, or printed it on the screen and then ran it directly into mysql...do you get the same results? Jeff Dan Greene [EMAIL PROTECTED]To: [EMAIL PROTECTED] active.com cc: Subject: FW: When inserting data it insert 2 records one correct and one blank! 10/09/2003 10:43 AM sending on to list while I think... ;) -Original Message- From: Emilio Ruben Estevez [mailto:[EMAIL PROTECTED] Sent: Thursday, October 09, 2003 10:34 AM To: Dan Greene Subject: RE: When inserting data it insert 2 records one correct and one blank! Ok, here it is the full statement: $sql = INSERT INTO llamadas (destinatario,fecha,hora,apellido,nombre,telefono,mail,receptor,mensaje) VALUES ('$destinatario','$fecha','$hora','$apellido','$nombre','$telefono','$mail','$receptor','$mensaje'); $result = mysql_query($sql); And, yes it happens to all users, and i ve tested pressing only once the submit button but i allways got 2 records add the first one is a blank one and the second the correct one. From: Dan Greene [EMAIL PROTECTED] To: Emilio Ruben Estevez [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: When inserting data it insert 2 records one correct and one blank! Date: Thu, 9 Oct 2003 10:09:00 -0400 Emilio, Can you supply the full insert statement? Also, is this happening for all users, or one in particular? I ask, as I've seen issues with web app users double-clicking the submit button causing similar issues -Original Message- From: Emilio Ruben Estevez [mailto:[EMAIL PROTECTED] Sent: Thursday, October 09, 2003 10:02 AM To: [EMAIL PROTECTED] Subject: When inserting data it insert 2 records one correct and one blank! Hi, I have a page on a intranet where workers can insert data into a database, the thing is that when they type the info an press submit the page use the INSERT INTO db then when i check the data in the database i can see the record that the user entered and a second record that is all in blank, exept for the date and time field that the value is -00-00 and 00:00:00. What´s wrong? maybe something of the date and time format?? Any Clue. Thanks. Emilio. _ Add MSN 8 Internet Software to your existing Internet access and enjoy patented spam protection and more. Sign up now! http://join.msn.com/?page=dept/byoa -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] _ High-speed Internet access as low as $29.95/month (depending on the local service providers in your area). Click here. https://broadband.msn.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: FW: When inserting data it insert 2 records one correct and one blank!
Emilio- I ran into this problem just yesterday using some PHP code. The problem was in control logic. I executed the insert within an if statement, but failed to see that there was another mysql_query statement outside the if block. This caused the same insert to happen again. Basically, in psuedo code if (found){ query = INSERT mysql_query (query) } else { query = UPDATE mysql_query (query) } mysql_query(query) Stupid logic on my part. This doesn't adress the date being blank, but I would suggest reviewing your logic to see if there is a mysql_query that is being executed 2 times. My 2 cents... Quoting Dan Greene [EMAIL PROTECTED]: sending on to list while I think... ;) -Original Message- From: Emilio Ruben Estevez [mailto:[EMAIL PROTECTED] Sent: Thursday, October 09, 2003 10:34 AM To: Dan Greene Subject: RE: When inserting data it insert 2 records one correct and one blank! Ok, here it is the full statement: $sql = INSERT INTO llamadas (destinatario,fecha,hora,apellido,nombre,telefono,mail,receptor,mensaje) VALUES ('$destinatario','$fecha','$hora','$apellido','$nombre','$telefono','$mail','$re ceptor','$mensaje'); $result = mysql_query($sql); And, yes it happens to all users, and i ve tested pressing only once the submit button but i allways got 2 records add the first one is a blank one and the second the correct one. From: Dan Greene [EMAIL PROTECTED] To: Emilio Ruben Estevez [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: When inserting data it insert 2 records one correct and one blank! Date: Thu, 9 Oct 2003 10:09:00 -0400 Emilio, Can you supply the full insert statement? Also, is this happening for all users, or one in particular? I ask, as I've seen issues with web app users double-clicking the submit button causing similar issues -Original Message- From: Emilio Ruben Estevez [mailto:[EMAIL PROTECTED] Sent: Thursday, October 09, 2003 10:02 AM To: [EMAIL PROTECTED] Subject: When inserting data it insert 2 records one correct and one blank! Hi, I have a page on a intranet where workers can insert data into a database, the thing is that when they type the info an press submit the page use the INSERT INTO db then when i check the data in the database i can see the record that the user entered and a second record that is all in blank, exept for the date and time field that the value is -00-00 and 00:00:00. What´s wrong? maybe something of the date and time format?? Any Clue. Thanks. Emilio. _ Add MSN 8 Internet Software to your existing Internet access and enjoy patented spam protection and more. Sign up now! http://join.msn.com/?page=dept/byoa -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] _ High-speed Internet access as low as $29.95/month (depending on the local service providers in your area). Click here. https://broadband.msn.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: FW: FW: When inserting data it insert 2 records one correct and one blank!
I think I got it What look like what is happening happening is that your page is running the insert when you present the form to the user, which is why the php variables are empty. when they submit the page, you are inserting the correct values. To test this, load the page up, do not submit it, and see if you have your empty row. If that is the case, then all you need to do is wrap the execution statement in an if condition to only process when the form is submitted -Original Message- From: Emilio Ruben Estevez [mailto:[EMAIL PROTECTED] Sent: Thursday, October 09, 2003 3:39 PM To: Dan Greene Subject: Re: FW: FW: When inserting data it insert 2 records one correct and one blank! Im lost, im new on php and mysql so i may be omitting some statements or logics i send you the entire script, its an lbi that i use on DreamWeaber MX if you can just take a look at it. Thanks. meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 ?php $db = mysql_connect(localhost, root); mysql_select_db(qllamo,$db); $sql = INSERT INTO llamadas (destinatario,fecha,hora,apellido,nombre,telefono,mail,recepto r,mensaje) VALUES ('$destinatario','$fecha','$hora','$apellido','$nombre','$tele fono','$mail','$receptor','$mensaje'); $result = mysql_query($sql); ? form method=post action=?php echo $PHP_SELF? input type=hidden name=id value=?php echo $id ? table bgcolor=#F2F0E0 tr tdDestinatario:/tdtd align=centerinput type=Text name=destinatario value=?php echo $destinatario ?br/td /tr tr tdFecha:/tdtd align=centerinput type=Text name=fecha value=?php print (date(Y-m-d)) ?br/td /tr tr tdHora:/tdtd align=centerinput type=Text name=hora value=?php print (date(h-i-d)) ?br/td /tr tr td align=leftApellido:/tdtd align=centerinput type=Text name=apellido value=?php echo $apellido ?br/td /tr tr tdNombre:/tdtd align=centerinput type=Text name=nombre value=?php echo $nombre ?br/td /tr tr tdTeléfono:/tdtd align=centerinput type=Text name=telefono value=?php echo $telefono ?br/td /tr tr tdMail:/tdtd align=centerinput type=Text name=mail value=?php echo $mail ?br/td /tr tr tdReceptor:/tdtd align=centerinput type=Text name=receptor value=?php echo $receptor ?br/td /tr tr tdMensaje:/tdtd align=centertextarea name=mensaje cols=70 rows=5 value=?php echo $mensaje ?/textareabr/td /tr tr center td input name=reset type=reset value=Borrar/td/center center td input type=Submit name=submit value=Grabar/td/center /tr /table /form From: Dan Greene [EMAIL PROTECTED] To: Emilio Ruben Estevez [EMAIL PROTECTED] Subject: FW: FW: When inserting data it insert 2 records one correct and one blank! Date: Thu, 9 Oct 2003 13:27:45 -0400 -Original Message- From: Matt Davies [mailto:[EMAIL PROTECTED] Sent: Thursday, October 09, 2003 11:10 AM To: Dan Greene Subject: Re: FW: When inserting data it insert 2 records one correct and one blank! Emilio- I ran into this problem just yesterday using some PHP code. The problem was in control logic. I executed the insert within an if statement, but failed to see that there was another mysql_query statement outside the if block. This caused the same insert to happen again. Basically, in psuedo code if (found){ query = INSERT mysql_query (query) } else { query = UPDATE mysql_query (query) } mysql_query(query) Stupid logic on my part. This doesn't adress the date being blank, but I would suggest reviewing your logic to see if there is a mysql_query that is being executed 2 times. My 2 cents... _ Instant message in style with MSN Messenger 6.0. Download it now FREE! http://msnmessenger-download.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]