I'm getting this error with the following code:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/me/public_html/hits.php on line 16
I'm trying to make a hit counter but it won't work. please help. thanks
<?php
mysql_connect("localhost", "user", "pass");
mysql_select_db("db");
mysql_query("update hits set hits = hits + 1");
$result = mysql_query("select * from hits");
while ($array = mysql_fetch_array($result, MYSQL_ASSOC))
{
$hits = $array[0];
}
print($hits);
?>
I found this link: http://www.phpfreaks.com/phpmanual/page/function.mysql-fetch-array.html but still cant figure it out...