I have modified the script as shown below. I have put in place
echo prompts to display values. Everything works fine except
my database update. I have set the VIEWCOUNT column to INT
w/ a default of 0. The script reads in the current values from DB
OK but does not update.
<?php
$dbcnx=mysql_connect("$server","$user","$password");
mysql_select_db("cannon");
$custinfo2=mysql_query("SELECT * FROM CUSTINFO WHERE ID=$id");
if (!$custinfo2) {
echo("<P>Error retrieving info from database!<BR>".
"Error: " . mysql_error() . "</P>");
}
while ($custinfo = mysql_fetch_array($custinfo2)){
$id=$custinfo["ID"];
$viewcount=$custinfo["VIEWCOUNT"];
}
mysql_close();
echo($viewcount);
echo"<BR>";
$viewcount=($viewcount + 1);
echo($viewcount);
echo"<BR>";
$servertime = time();
$second = date("s", ($servertime));
$minute = date("i", ($servertime));
$hour = date("G", ($servertime));
$day = date("j", ($servertime));
$month = date("n", ($servertime));
$year = date("y", ($servertime))+2000;
$viewdate = $year.'-'.$month.'-'.$day.' '.$hour.':'.$minute.':'.$second ;
$dbcnx=mysql_connect("$server","$user","$password");
mysql_select_db("cannon");
$sql="UPDATE CUSTINFO SET ".
"VIEWCOUNT='$viewcount',".
"VIEWDATE='$viewdate' ".
"WHERE ID='$id';";
mysql_close();
echo($viewcount);
echo"<BR>";
echo($viewdate);
echo"<BR>";
echo($id);
?>