For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > March 2007 > RE: [PHP-DB] do not display dublicated entries









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author RE: [PHP-DB] do not display dublicated entries
Bastien Koert

2007-03-13, 9:59 pm

use the DISTINCT(IP) (the DISTINCT keyword)

bastien


>From: "septic" <nrasidakis@hotmail.com>
>To: php-db@lists.php.net
>Subject: [PHP-DB] do not display dublicated entries
>Date: Tue, 13 Mar 2007 23:29:58 +0200
>
>Hello all,
>
>I have created a simple webtracer for my website and I save some info on
>mysql database.
>
>table = tracker
>
>FIELDS
>ip
>day
>month
>year
>session_id
>browser of visitor
>page that was visited
>
>
>What I would like to do next, is simple to create an output of that
>database with the last time that every different IP has visited my website.
>
>the best output I have at the moment is:
>
>$query = "SELECT ip,day,month,year FROM tracker WHERE page = 'index' ORDER
>BY `tracker`.`year` DESC , `tracker`.`month` DESC , `tracker`.`day` DESC
>LIMIT 0,20 ";
>
>The problem is that I want to Keep for each different IP the fisrt entry
>that is found on this output I get.
>
>therefore I would say that the output would represent the last visit of
>each
>different user on my website.
>
>do you know of a php or sql trick to avoid entries that containt the same
>IP
>entries ?
>
>Thanks in advance for the help.
>Nikos.
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>


________________________________________
_________________________
Have Some Fun Out Of The Sun This March Break
http://local.live.com/?mkt=en-ca/?v...6D6BDB4586E357F!142
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com