webmastadj84
IS-IT--Management
I am having some trouble with some PHP code. It will not do what I need it to do which is get information from a database, add a count to it, then update the record in the database. The select works and the addition works, but it will not update the record...any suggestions?
Here is the code:
$sql = "SELECT `Count` FROM `counters` WHERE `Site`='1'";
$result = mysql_query($sql);
$newArray = mysql_fetch_array($result);
$CountNumber = $newArray['Count'];
echo "$CountNumber";
$CurrentCount = $CountNumber + 1;
echo "$CurrentCount";
$sql2 = "UPDATE `counters` SET `Count`=\'$CurrentCount\' WHERE `Site`=\'1\'";
mysql_query($sql2);
Here is the code:
$sql = "SELECT `Count` FROM `counters` WHERE `Site`='1'";
$result = mysql_query($sql);
$newArray = mysql_fetch_array($result);
$CountNumber = $newArray['Count'];
echo "$CountNumber";
$CurrentCount = $CountNumber + 1;
echo "$CurrentCount";
$sql2 = "UPDATE `counters` SET `Count`=\'$CurrentCount\' WHERE `Site`=\'1\'";
mysql_query($sql2);