I’ve been using this for a long time and now it stopped working. I just don’t get why PHP changes on you. Someone help.
The problem is with these two lines:
$res = mysql_query("SELECT num FROM ywsite WHERE item='sitehits'", $db);
$num = mysql_result($res,0,"num");
Here’s the rest of the script:
<?php
$res = mysql_query("SELECT num FROM ywsite WHERE item='sitehits'", $db);
$num = mysql_result($res,0,"num");
$equals = $num + 1;
mysql_query("UPDATE ywsite SET num='$equals' WHERE item='sitehits'");
?>
That seems like a rather complicated way to increment a number. Just do this instead:
If it fails use mysql_error to see the error. The most likely cause of error is an incorrect table or column name.