Re: Last visitors

From: Date: Wed, 20 Apr 2005 04:16:30 +0000
Subject: Re: Last visitors
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-213464@lists.php.net to get a copy of this message
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

« previous php.general (#213464) next »