From: [EMAIL PROTECTED] Operating system: Linux PHP version: 4.1.2 PHP Bug Type: MySQL related Bug description: Mysql query executed two times, although called only once
I have the following script: function log_query($q) { echo $q."<br/>\n"; return mysql_db_query('logs', $q); } global $REMOTE_ADDR, $HTTP_USER_AGENT, $HTTP_SESSION_VARS; $agent = addslashes($HTTP_USER_AGENT); $logged_user = $HTTP_SESSION_VARS['userinfo']['username']; $query = "update ichb_hits set count = count + 1 where ip = '$REMOTE_ADDR' and user = '$logged_user' and agent = '$agent' and date > (now() - INTERVAL 1 HOUR)"; $res = log_query($query); if (@mysql_affected_rows() <= 0) { $query = "insert into ichb_hits (ip, count, date, user, agent) values ('$REMOTE_ADDR', 1, now(), '$logged_user', '$agent ')"; log_query($query); } This script is in a file called 'log.php'; I include this log.php only once. The update query is displayed only once, but the count increases two times; not by 2, but two times at an interval of a quarter of a second. Configure Command : './configure' '--with-mysql' '--with-gd' '--with-zlib' '--with-apxs' Try http://db.lumina.ro/info.php for details about PHP installation. -- Edit bug report at http://bugs.php.net/?id=16634&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=16634&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=16634&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=16634&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=16634&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=16634&r=support Expected behavior: http://bugs.php.net/fix.php?id=16634&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=16634&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=16634&r=submittedtwice