Hi!

I've had a good look through the documentation and here is where I am:

I'm logging users coming in to a web site, by ip address  column called ip
and by dateIn (a
timestamp of 14 bytes).  I'd like to list (one row per day) the COUNTs of
unique (DISTINCT) ip addresses.  I'd also like to have the dates listed in
the format: 17.11-2002, for each row.

Here is what I tried.  The table "test" is in preparation for setting up a
temporary table instead of a permanent one - it was so I could look at it
and see what I was getting.  The last query and listing doesn't produce any
output. . .

MYSQL_QUERY('DROP table test from log');

MYSQL_QUERY('Create table test select ip, uid, dummy from log');

//Here we want to get the timestamp in table "log" in form like 17.11-200,
so we collect the data and put into another table
$quackA=MYSQL_QUERY("select ip, dateIn, uid, dummy from log");
  while(@$row = mysql_fetch_array($quackA))
  {
$dt=$row[dateIn];  $uid=$row[uid];
if (ereg ("([0-9]{4})([0-9]{1,2})([0-9]{1,2})([0-9]{6})", $dt, $regs))
                        {
                    $dt="$regs[3].$regs[2]-$regs[1]";
//Now we put the modified timestamp into the columne "dummy" in table "test"
MYSQL_QUERY("update test set dummy='$dt' where uid='$uid' ");
                        }
 }//end of while

//The following was supposed to create a count, by day, of the unique ip
addresses.  It in fact produces no output
$quackA=MYSQL_QUERY('select COUNT(DISTINCT ip) from log GROUP BY dummy');
while ($row=mysql_fetch_row($quackA))
{
echo "$row[ip] $row[dummy] <br>";
}


Thanks for any help or advice!

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

Reply via email to