Hi guys,
Cant figure out why this wont work.
I have built a little db on my website toi collect system stats.
In my DB i have 4 fields:
sysID=(No)Auto_increment
sysRes= "varchar"
sysIP="varchar"
sysDate="dateTime()"
I am trying to get the number of user visits per day. So we collect all the dates from the DB and then Group them.
SELECT DATE_FORMAT( sysDate, '%Y-%m-%d' )
FROM scStats
GROUP BY DATE_FORMAT( sysDate, '%Y-%m-%d' )
ORDER BY sysDate DESC
Does as supposed to.
Output:
2005-06-15
2005-06-14
2005-06-13
2005-06-12
2005-06-11
2005-06-10
2005-06-09
2005-06-08
2005-06-07
2005-06-06
2005-06-05
2005-06-04
2005-06-03
2005-06-02
2005-06-01
The script was tested via phpmyadmin.
in my php file i have the query as above and then the following to breakdown the array:
$result = mysql_query($query);
$visCount = mysql_num_rows($result);
for ($count = 0; $count < $visCount; $count++){
$dates = mysql_fetch_array($result);
$sysDate = $dates["sysDate"];
echo "<BR>". $count .". sys date = " . $sysDate;
}
$sysDate returns empty.
anyone got any ideas where i am going wrong?
Thanks
Paul