PHP
<?PHP
$id = $_GET['id'];
$dbh=mysql_connect ("localhost", "codetut_greg", "********") or die ('I cannot connect to the database because: ' . mysql_error());
if(!$dbh) { echo "error"; }
mysql_select_db ("codetut_main");
$query = "SELECT clicks FROM tutorials WHERE ID = '$id'";
$result = mysql_query($query);
$clicks = mysql_fetch_object($result);
$clicks = $clicks->clicks;
echo $clicks;
$sql = "UPDATE tutorials SET clicks = $clicks + 1 WHERE ID = $id";
$result2 = mysql_query($sql);
if(!$result2) { echo "error on 2nd query"; }
?>
If I put the code in any other page though, it only increments by one. Could it be that the code is on a page with a frameset?