hi all,
the below code is a simple count function. It is supposed to update the simplecount table each time the page is visited.
However, the code gives the final result of 0 rows updated.
Why is this?
Thanks.
<?php
echo 'hello';
// Database connection
@ $db = mysql_pconnect('localhost', 'user', 'pword');
if (!$db)
{
echo 'Could not connect';
exit;
}
mysql_select_db('test') or die ('No Database');
$query = "update simplecount set count = count+1";
$result = mysql_query($query) or die(mysql_error());
if ($result)
{
echo mysql_affected_rows().' inserted into DB';
}
?>