rhboarder
October 1st, 2010, 01:03 PM
This is probably the simplest thing but I'm not catching it, basically im increasing a variable that got its value from a database by 1 (so var++) but then I check it and it had been increased by 2. heres the code:
$res = mysql_query($query);
//retrieve hitcount from the returned array
$data = mysql_fetch_assoc($res);
$count = $data['hitcount'];
//$count++;
mysql_free_result($res);
//enter the new value of hitcount to the database
$query = "UPDATE hitcount SET hitcount='".$count."'";
mysql_query($query);
After its run, if i go into the database to and view the value of hitcount its 1 more than it should be...
$res = mysql_query($query);
//retrieve hitcount from the returned array
$data = mysql_fetch_assoc($res);
$count = $data['hitcount'];
//$count++;
mysql_free_result($res);
//enter the new value of hitcount to the database
$query = "UPDATE hitcount SET hitcount='".$count."'";
mysql_query($query);
After its run, if i go into the database to and view the value of hitcount its 1 more than it should be...