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

Posted by Richard Lynch on 04/20/05 07:16

On Tue, April 19, 2005 5:57 am, Ryan A said:
> 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....

One possibility not yet discussed...

I *think* MySQL has an 'array' data type.

You could then have an array of size 10 on each record.

Then, if MySQL has some kind of array_push and array_slice, you'd be able
to do:

update users set profile_viewers = array_slice(array_push($this_visitor,
profile_viewers), 1, 10) where user_id = $this_profile_id

Hopefully, you can even do something like:

select * from users as viewers, users as this_one
where this_one.user_id = $this_profile_id
and in_array(viewers.user_id, this_one.profile_viewers)

I have NO IDEA if MySQL actually has all this functionality, but if it
does, it may be more clear and/or efficient than a 10-to-1 table...

--
Like Music?
http://l-i-e.com/artists.htm

 

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

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