RE: Mozilla inserts twice, IE does OK... ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



And now it double-inserts again. I was too quick with my previous mail :-)
 The quest continues... :-)

Steven

> Hi all
>
> Note in the source that in the MySQL Insert query "VALUES" starts at a new
> line.
>
> I put a DELETE command right after the INSERT command, to temporary catch
> the double line.  When I did that, I placed the "VALUES..."-part on the
> same line as the first part of the query and the double inserts
> disappeared.  (ofcourse)
>
> Weird is:  I removed the DELETE-command, and placed the VALUES-part on
> another line again, and the data is still inserted once in the table.
>
> Very strange, but I hope putting all of the query on a single line is a
> possible solution for this weird behavior :-)
>
> Anyone has any idea about this ?
>
>
> Steven
>
>
>> I'm not using the browsers 'view source' at all...  Only the 'view
>> source'
>> function from PHP.
>> But when none of the source is checked, and even right after a restart
>> of
>> MySQL and Apache, the dual insert resists...
>>
>> Funny thing is, I've had this problem in another section of the site,
>> and
>> it
>> disappeared without any known cause.
>> And not to forget: problem doesn't appear in IE6, only in Mozilla and
>> firefox running on WinXP and Gnome2.
>>
>>
>> The code:
>> The file is called shop.php, and contains different functions indicated
>> by
>> a
>> query-string value and separated by a Switch-structure.
>> I post the global code and the section for saving this data into MySQL.
>> If
>> you need the other code, please ask me
>> (I'm trying to avoid that for mailing too much code at once...)
>>
>> <?php
>>         require ("classes/class_shops.php");
>>         $shop = new shop;
>>
>>         $dbconn=mysql_pconnect("localhost", "steven", "steven") or die
>> (mysql_error());
>>         mysql_select_db("steven");
>>
>>
>>         function pageheader () {
>>                 echo "<h1>SHOPS</h1>";
>>         }
>>
>>         $id = $_GET["id"];
>>         $shopmode = $_GET["shopmode"];
>>
>>         pageheader();
>>
>>         switch ($shopmode) {   //shop, cat, item, reg, verify, save,
>> default
>> 		case "shop":
>> 			...
>> 		case "cat":
>> 			...
>> 		case "item":
>> 			...
>> 		case "reg":
>> 			...
>> 		case "verify":
>> 			...
>> 		case "save":
>> 	                        echo "SAVE";
>>             	            $name = $_POST["name"];
>>                         	$logo = $_POST["logo"];
>> 	                        $logoname = $_POST["logoname"];
>>             	            $address = $_POST["address"];
>>                         	$pcode = $_POST["pcode"];
>> 	                        $location = $_POST["location"];
>>             	            $area = $_POST["area"];
>>                         	$phone = $_POST["phone"];
>> 	                        $email = $_POST["email"];
>>
>> 			//THIS is code that inserts an already uploaded
>> image in a separate table, and returns the ID
>>             	            if ($logoname!="" && $logo!="") {
>>                         	        require ("classes/class_image.php");
>> 	                                $img = new image;
>>             	                    $upload = $img->image_upload($logo,
>> $logoname);
>>                         	        $logoID = $upload[2];
>> 	                        } else {
>>             	                    $logoID="";
>>                         	}
>>
>>             	            mysql_query ("INSERT INTO shop (name, logo,
>> address, pcode, location, area, phone, email, dateadded)
>> 	                                VALUES ('$name', '$logoID',
>> '$address', '$pcode', '$location', '$area', '$phone', '$email', '" .
>> microtime() . "');", $dbconn) or die("ikke: " . mysql_error());
>> 	                        echo "Uw gegevens werden bewaard!  Klik <a
>> href=>hier</a> om terug te gaan";
>> 			//translated: Your data has been saved!
>> 	                        break;
>> 		case default:
>> 			...
>> 	}
>> ?>
>>
>>
>>
>> -----Original Message-----
>> From: Norland, Martin [mailto:Martin.Norland@xxxxxxxxxx]
>> Sent: maandag 6 december 2004 15:53
>> To: php-db@xxxxxxxxxxxxx
>> Subject: RE:  Mozilla inserts twice, IE does OK... ?
>>
>> Are you using view source a lot?  (some of) Mozillas view source
>> commands send the query again, minus the POST vars.  This could be the
>> behaviour you're seeing.
>>
>> I say some of because there are multiple ways of viewing the source -
>> web developer toolbar's (extension) doesn't seem to suffer from this
>> problem.  I'm a little cloudy on the specifics, it's a big muddled mess
>> :)
>>
>> Cheers,
>> - Martin Norland, Database / Web Developer, International Outreach x3257
>> The opinion(s) contained within this email do not necessarily represent
>> those of St. Jude Children's Research Hospital.
>>
>>
>> -----Original Message-----
>> From: Steven [Offstage] [mailto:steven@xxxxxxxxxxx]
>> Sent: Sunday, December 05, 2004 4:42 PM
>> To: php-db@xxxxxxxxxxxxx
>> Subject:  Mozilla inserts twice, IE does OK... ?
>>
>>
>> Hi there,
>>
>> First post to this mailing list, and I have a very strange problem:
>>
>> I'm using Apache2 with PHP 4.3.9 and MySQL 4.0.21.  Sometimes when I
>> execute an INSERT-query using mysql_query, the data is inserted twice.
>> I'm 150% sure the code is only executed once!  I tried this by adding
>> 'echo "test";'  right before and right after my mysql_query command.
>>
>> The double insert happens only when surfing with Mozilla and Firefox.
>> In Internet Explorer 6  the data is inserted only once (as should be).
>>
>> I found some clues pointing in the direction of sessions, but after
>> commenting  out all other sections of the site and so eliminating all
>> other code, the problem was still there...
>>
>> Has anyone any idea in what direction I have to look for a cause or
>> solution ?
>>
>> Thanks in advance!
>>
>> Steven
>> ---
>> from Antwerp - Belgium
>>
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>> --
>> No virus found in this incoming message.
>> Checked by AVG Anti-Virus.
>> Version: 7.0.289 / Virus Database: 265.4.5 - Release Date: 3/12/2004
>>
>>
>> --
>> No virus found in this outgoing message.
>> Checked by AVG Anti-Virus.
>> Version: 7.0.289 / Virus Database: 265.4.6 - Release Date: 5/12/2004
>>
>>
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux