You are here: [PHP] Last visitors « PHP « IT news, forums, messages
[PHP] Last visitors

Posted by Ken on 04/19/05 16:04

On 4/19/05, Ryan A <ryan@coinpass.com> wrote:
> <clip>
> >> the site works like this:
> > > if you are a "guest" you can see only limited details of a profile, if
> > you
> > > have logged in, you see many more details.
> > > On the profile page there should be "last 10 visitors", it will not
> > register
> > > the guests, but if someone had logged in and visited your profile, it
> > should
> > > show their username....if there are 10 enteries in the db and when the
> > 11th
> >
> > > person comes...then the first person who came should be "bumped" off and
> > the
> > > 11th person takes his place and so on....
> </clip>
>
> ########
> Instead of having a seperate table to see the latest people logged on,
> isn't it better to query an existing user table based on the last
> login time?
>
> SELECT username from users ORDER BY login_time DESC LIMIT 10?
> ########
>
> I am not checking for the last people logged in, I want to see the last
> people who have viewed the profile...
> each profile will have its own last "10 people visited"
>
> Thanks,
> Ryan
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005
>
>

ah! i see. sorry for misunderstanding you.
perhaps on the script for the profiles page, the logic should be like:

profile for user: adam

if the browsing user is logged in: (for example the browsing user is ben)
insert into the database that ben has seen adam's profile
end if....

and your table in the database can be:

user visitor time_of_visit
adam ben 1290122141 (unix timestamp)

then you can query it on the database for each user.

SELECT * FROM profile_visits WHERE user='adam' ORDER by time_of_visit
DESC LIMIT 10

As for cleaning up... that's the bit that I can't figure out myself :(.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация