Re: Double Inserts

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

 



Hi Shri,

sshrikant@xxxxxxxxxx (PHPDiscuss - PHP Newsgroups and mailing lists) writes:

> Hi, I am new to the mailing list and to PHP / MySQL. I am facing an
> unususal problem. I am trying to insert some data into MySQL DB through
> via Web. The code is executed OK - no errors but the same record gets
> inserted TWICE. I have checked the code and simplified it as much as
> possible and tried test scripts with same results. I have also tried
> statements to echo messages to ensure the code is not executed twice. 
> 
> It happens with IE as wells as Mozilla so I don't think it is a browser
> issue. The only clue is that it does not seem to happen on a slower
> machine (Laptop). The configurations, versions etc are identical - Apache
> 2.0.49, MySQL 4.1.6-gamma-nt, PHP 5.0.2
> 
> Has anyone faced this and found a solution? Please help.
> 
> Shri

I had a similar problem.  It was unrelated to PHP or MySQL.  Are you using
javascript as part of the page?  In particular, attaching an event handler
to onSubmit event?

I had an onSubmit event handler that called this.submit() as part of the
routine.  I didn't realize that caused the submit to happen twice.  The
double insert has vanished since.

See if your page is getting posted twice for whatever reason.

-Peter

-- 
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