Re: [PHP-DB] Count unique visits in PHP/MySQL

2004-06-08 Thread Ignatius Reilly
Here is how I would do: 1. Group your visits by IP, order them in time and give each row a sequential number starting with 1 (not completely trivial - exercise left to the reader) Now you have a temporary table T ( ip, timestamp, rank ) 2. Join the table to itself on two consecutive rows, and co

[PHP-DB] Count unique visits in PHP/MySQL

2004-06-08 Thread veditio
I am making a PHP/MySQL traffic report page from a table that records some user activity using PHP referrer information. I have a table with three rows: IP, page_name, and timestamp. The IP row records the user's IP address, page_name records the name of the page that the user loaded, and the t

[PHP-DB] Re: DISTINCT and multiple results...

2004-06-08 Thread Rui Cunha
Hi, maybe you're looking 4 something like this: select user , filename , count(filename) from table group by user,filename having count(filename) = 3 order by 1,2; Rui [EMAIL PROTECTED] writes: Hi there... I'm trying to create a MYSQL query that does the following... I've a table that l

Re: [PHP-DB] About retrieving auto increment value

2004-06-08 Thread Ignatius Reilly
LAST_INSERT_ID() is connection-based, not table-based. Therefore instead of: SELECT LAST_INSERT_ID() FROM foo_table you should do: SELECT LAST_INSERT_ID() HTH Ignatius _ - Original Message - From: "Marc Soler" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Mond