# Mysqli/PHP INSERT statement performed twice

## audiodef

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?   :Shocked: 

----------

## tomk

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.

----------

