Jump to content

Problem with duplicate update


[dx]

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...