RE: [PHP] Best way to do "Last 3 Items Viewed"
| From: | Chris W. Parker | Date: | Fri, 14 May 2004 18:14:03 +0000 |
| Subject: | RE: [PHP] Best way to do "Last 3 Items Viewed" | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-186247@lists.php.net to get a copy of this message | ||
Chuck Barnett <mailto:cbarnett@wildlifeart.com>
on Friday, May 14, 2004 10:42 AM said:
> Anyone have any code snippits that would allow me to do a "Last 3
> Items Viewed" like on ebay?
no but i can give you a suggestion as to a method...
each time someone views an item do a first-in-last-out rotation of a
cookie.
in other words.. each time you come to a page do the following: (pseudo
code)
COOKIE['item3'] = COOKIE['item2'];
COOKIE['item2'] = COOKIE['item1'];
COOKIE['item1'] = $new_value;
then you go back and read the three items and you're done.
hth,
chris.