Bug #16668 Updated: Mysql query executed two times, although called only once
| From: | derick@php.net | Date: | Thu, 18 Apr 2002 06:31:49 +0000 |
| Subject: | Bug #16668 Updated: Mysql query executed two times, although called only once | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-5263@lists.php.net to get a copy of this message | ||
ID: 16668
Updated by: derick@php.net
Reported By: avaly@rol.ro
-Status: Closed
+Status: Bogus
Bug Type: MySQL related
Operating System: Linux
PHP Version: 4.1.2
New Comment:
Not a bug > Bogus
Previous Comments:
------------------------------------------------------------------------
[2002-04-18 02:12:51] avaly@rol.ro
I figured it out. It was because of an image with a blank src
attribute, which made the browser load the index.php file again which
included log.php again.
Sorry for the trouble !
------------------------------------------------------------------------
[2002-04-17 15:41:16] avaly@rol.ro
I'm sorry I'm opening this bug again, but I was told that my bug was
something like
http://bugs.php.net/bug.php?id=10599&edit=1
but I don't think it's true because the problem there was in HTML; I
don't have any HTML code here.
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.
If I access the file log.php by itself it executes the query corectly!
Configure Command : './configure' '--with-mysql' '--with-gd'
'--with-zlib' '--with-apxs'
Try http://db.lumina.ro/info.php for details about PHP
installation.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=16668&edit=1