Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Highlight newest added items

Status
Not open for further replies.

ralphiooo

Programmer
Oct 23, 2005
64
GB
Hi, i store the date i insert items into the database using unix timestamps. For my logged in users i need to highlight newest added items since there last visit. I was wondering what's the logic behind this and the easiest way of implementing this. I had a shot but my brain couldn't handle it.

Appreciate the help. Thanks
 
assume:
1. you want the three latest additions
2. the timestamp is called "tmstamp"

Code:
$sql = "Select * from $table order by `tmstamp` desc limit 3";

this will just return the last three

if you want the entire set returned then remove the limit clause. then as you iterate through the recordset keep a counter and highlight (use a css declaration) the first 'n' rows that are returned.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top