i have a table called 'hits' with a column named for each page on my site. whenever a page loads, i'd like the script to get the number of 'hits' stored in the table for that page, add one to it, then replace the previous entry, so that i have a table with all the hits for each page. there's only 1 row in the table. here's what i have so far for the page called works2:
(all of the or dies are for debugging)
$query_hits = "select works2 from hits"
or die("error01");
$result_hits = mysql_query($query_hits)
or die("error02");
$row_hits = mysql_fetch_row($result_hits);
echo ("$row_hits[0]")
or die("error07");
while ($row_hits = mysql_fetch_row($result_hits))
{
$new_row_hits = $row_hits[0]++
or die("error04");
$query_hits2 = "update hits set works2='$new_row_hits' where works2='$row_hits[0]'"
or die("error05");
$result_hits2 = mysql_query($query_hits2)
or die("error06");
}
echo ("$new_row_hits")
or die("error08");
right now i'm getting error07 which is the echo("$row_hits[0]") line.
is this the right way to do this? any suggestions?
~JOSH