hmm... seems a MySQL topic.
I suppose that your table is filled with correct data at some other
point. So what you need is a count query that returns
*one* result and not all records in that table. You do not want a
*while* loop in your PHP script, because that would show a list of
unique ips. So my gues would be:
$result = mysql_query("SELECT COUNT(DISTINCT IP) AS ips FROM ma_counter");
$ips = mysql_fetch_row($result);
pintf("Visitors = %d",$ips);
Disclaimer: code not tested. You might want to check the MySQL manual
for syntax details of the query.
Good luck
Ren�
John Wulff wrote:
>You're a savior, don't know how i missed that. Thanks a bunch. Now, one
>more quick question if you don't mind. I've got this query at the bottom
>of my page for the purpose of a counter. But naturally i don't want a
>list of all the ips logged, i just want a count of how many unique ips
>there are in the table. How do i go about this?<?php
>$result = mysql_query("SELECT distinct ip from ma_counter");
>while(list($ip) = mysql_fetch_row($result))
>{
>print ("$ip");
>}
>?>
>
>
>
>
>><snip>
>>
>>
>>
>>> $mode = "entrance";
>>> if ($mode == "entrance") {
>>>
>>>
>>>
>></snip>
>>I suppose you added the first line ($mode = "entrance"; ) for testing
>>purposes during debugging, but in order for the script to work you
>>should now remove it, because now $mode will always have the value
>>"entrance"
>>
>>good luck
>>
>>
>>Ren�
>>
>>
>
>
>
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php