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
bedul

2007-03-13, 9:59 pm


----- Original Message -----
From: "septic" <nrasidakis@hotmail.com>
To: <php-db@lists.php.net>
Sent: Wednesday, March 14, 2007 4:29 AM
Subject: [PHP-DB] do not display dublicated entries


> 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


how about change the fields
ip
date (contain both day,month and year)
session_id
Browser
page


> 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 ";

i think when u able to change the field.. i hope you will have easy sql

select * from tracker where page='index'
order by date DESC limit 0,10

other trick:
select * from tracker where page='index'
order by id DESC


>
> 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 ?

there is no trick.. i believe is a matter of programing..
to me i using mktime() to the date (not type date)
but in the end.. i should create a date than an integer.

is you decision to follow me using integer ( by mktime() ) or using date.

> Thanks in advance for the help.

btw.. i was wondering.. you enter date but why you not enter the time.


> Nikos.
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

Sponsored Links







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

Copyright 2008 codecomments.com