Hi!
I wrote in a little while ago about getting unique visits to a website
listed by day. Martin Waite came up with a very nice formulation, which
does wonders!
However, I have done something that is now yielding inconsistent results.
The screen shot is basically like this:
Day by Day Summary for Unique Visits since civic elections (Nov 16)
Date Count Summary
17.11-2002 8
18.11-2002 62
19.11-2002 14
----------------------------------------------------------------------------
----
Current TOTAL for Visits since civic elections (Nov 16): 79
----------------------------------------------------------------------------
----
As you can see the day-by-day summaries are 8 + 62 + 14 = 84, yet the TOTAL
reported is 79.
My query must be somehow flawed but I'm not sure how - in both cases I count
DISTINCT the ip. . . Here is exactly what I did:
//Get day by day report of visits
$getInfoA=MYSQL_QUERY("select date_format(dateIn,'%d.%m-%Y')day ,
count(DISTINCT ip) as cnt from b_monitor group by day ");
echo "<div align='center'><hr width='50%'><br><font size=4>Day by Day
Summary for Unique Visits since civic elections (Nov 16)<br>";
print "<table columns=2 border='1'><tr><td width='120'><div
align='center'><b>Date</b></div><td width='120'><div align='center'><b>Count
Summary</b></div></td>";
while(@$row = mysql_fetch_array($getInfoA))
{
echo "<div align='center'><tr><td><div
align='center'>$row[day]</div><td><div
align='center'>$row[cnt]</div></tr></td>";
}
print "</table>";
print "<table columns='1' width='45%' border='0'><tr><td>";
print "The count for today is incomplete. It will change as the day
progresses. Hit your reload button, or refresh button for up-to-the-second
results, if your window has been sitting open for some time.";
print "</tr></td></table>";
//Now we get the TOTAL number of unique visits
$getInfoA=MYSQL_QUERY('select COUNT(DISTINCT ip) from b_monitor ');
$getInfo1=mysql_fetch_row($getInfoA);
$howManyVisitors=$getInfo1[0];
echo "<div align='center'><br><hr width='50%'><font size=4>Current TOTAL for
Visits since civic elections (Nov 16): $howManyVisitors<br>";
====================================
Thanks so much for your assistance - I learn a great deal from even your
most off-hand comments!
Cheers!
-warren
---
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.419 / Virus Database: 235 - Release Date: 13/11/2002
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php