Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Mysqli/PHP INSERT statement performed twice
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6639
Location: The soundosphere

PostPosted: Mon May 09, 2011 3:21 pm    Post subject: Mysqli/PHP INSERT statement performed twice Reply with quote

This isn't about code, but about a Mysql/PHP/Apache configuration, because I'm now fairly sure this is where the problem is. In fact, I've eliminated the possibility of a code typo/bug, since the same code works on my live server but not on my localhost.

The problem is this: when I run an INSERT statement via mysqli/PHP, it gets done twice. No other kind of query is done twice. Only on my localhost is it done twice. This doesn't happen on my live server where I host my web site. The versions of Mysql/PHP/Apache are the same, and the use flags (minus one or two that I'm positive have no bearing on this) are the same.

I have not found anything about this happening to anyone else, so this is pretty odd. Can anyone think of anything in a LAMP configuration that would cause this to happen?

I get no errors from PHP or Mysql, but if I have a unique restriction on a table, I get back a duplicate entry error from Mysql (which is expected).

What in the blazes would make an INSERT happen twice on one server but nowhere else? 8O
_________________
decibel Linux: https://decibellinux.org
Github: https://github.com/Gentoo-Music-and-Audio-Technology
Facebook: https://www.facebook.com/decibellinux
Discord: https://discord.gg/73XV24dNPN
Back to top
View user's profile Send private message
tomk
Bodhisattva
Bodhisattva


Joined: 23 Sep 2003
Posts: 7221
Location: Sat in front of my computer

PostPosted: Mon May 09, 2011 3:45 pm    Post subject: Reply with quote

Very strange indeed, at a guess I'd say there's either some configuration difference (but I don't know of any off the top of my head that would cause this) or some kind of transaction/reconnection issue.

Can you provide diffs of the php.ini and my.cnf files between the two boxes?

Another thing to check is adding query logging (log = /path/to/log in my.cnf) and see if the two inserts are from the same connection.
_________________
Search | Read | Answer | Report | Strip
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum