Couple of options: a CRON job/scheduled job which invokes a SQL command deleting all but the 10 most recent records, or do the same every time you insert a record. As to exactly how you decide which are the most recent 10 records to do this deletion, that is a little more complex. Something like DELETE FROM profile_visits WHERE user='billy' AND time_of_visit NOT IN ( Select time_of_visit FROM profile_visits WHERE user='billy' ORDER by time_of_visit DESC LIMIT 10 ) Should give you an idea. Mark -----Original Message----- From: Ryan A [mailto:ryan@xxxxxxxxxxxx] Sent: 19 April 2005 14:27 To: kenkam@xxxxxxxxx Cc: php Subject: Re: Last visitors > 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" /* 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 :(. */ Hey, Thanks for replying. > ah! i see. sorry for misunderstanding you. No problem, I guess i didnt explain it well enough, and you dont have to help me but you are trying, so thank you. > As for cleaning up... that's the bit that I can't figure out myself > :(. exactly, I came to the same part as you....but then i would have a LOT of wasted records without the cleanup... just cant figure it out. 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, Cisco, Sun Microsystems, 3Com GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 2000' REGISTERED COMPANY ********************************************************************** CONFIDENTIALITY NOTICE: This Email is confidential and may also be privileged. If you are not the intended recipient, please notify the sender IMMEDIATELY; you should not copy the email or use it for any purpose or disclose its contents to any other person. GENERAL STATEMENT: Any statements made, or intentions expressed in this communication may not necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no content herein may be held binding upon Gamma Global (UK) Ltd or any associated company unless confirmed by the issuance of a formal contractual document or Purchase Order, subject to our Terms and Conditions available from http://www.gammaglobal.com E&OE ********************************************************************** ********************************************************************** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php