Code: Select all
$todaydate = (date('Y-m-d'));
include "dbconn.php";
$counter = mysql_query ("SELECT * FROM stats WHERE page = 'template' AND date = '$todaydate'");
if (mysql_num_rows($counter)==0)
{
mysql_query ("INSERT INTO stats (page, date, count) VALUES ('template', '$todaydate', '1')");
}
else
{
while ($rowcount = mysql_fetch_object($counter))
{
$counttotal = $rowcount->count + 1;
mysql_query ("UPDATE stats SET count = '$counttotal' WHERE id = '$rowcount->id'") or die (mysql_error());
}
}
mysql_free_result($counter);
mysql_close($sqlconn);However, this script is making each day show:
2 May and 1st May, I entered myself. But 3rd and 4th, are from the code. No way was it over 300K yesterday, and this morning in just a few hours, 422k+ ???04 May 2011 422332
03 May 2011 333421
02 May 2011 108513
01 May 2011 105291
What have I done wrong in my code?