Counters :: Double, Triple :: What The Hell

From: Date: Fri, 19 Jul 2002 20:42:22 +0000
Subject: Counters :: Double, Triple :: What The Hell
Groups: php.general 
Request: Send a blank email to php-general+get-108571@lists.php.net to get a copy of this message
Function CountIt($action, $counter) { $sql = "SELECT ".$counter." FROM counters WHERE id='1'"; $res = mysql_query($sql); $num = mysql_result($res, 0, $counter); if($action == "more") $num++; if($action == "less") $num--; $sql = "UPDATE counters SET ".$counter."='".$num."' WHERE id='1'"; $res = mysql_query($sql); } That is my script.... I call it CountIt('more','hits'); but everytime i call it, the dam thing always adds 2 counts Can anyone identify an error please

« previous php.general (#108571) next »