Jump to content

Problem with duplicate update


[dx]
 Share

Recommended Posts

Hi, I'm using this SQL statement but it updates twice. I'm sure that this line is writtent just on one place in whole page.

mysql_query("INSERT INTO clicks (year, ".strtolower(date('M')).") VALUES ('".date('Y')."', '1') ON DUPLICATE KEY UPDATE ".strtolower(date('M'))."=".strtolower(date('M'))."+1");

So it works fine just instead of it is doing increment by 2. I've tried standard mod with select, checking update if num rows > 0, or else insert. Like it calls statement twice. Can it be some error with mysql?

Link to comment
Share on other sites

do you mean in increment in auto incremented field?

Link to comment
Share on other sites

Hi, Just a hint to anyone who get stuck with this problem. Check does your page tries to load some element which is empty. In my case that was <link rel="shortcut icon" href="/favicon.ico"> but favicon.ico wasn't located at server. After I've added it, it started working normal.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...