ALTER TABLE jos_afm_cats add column date TIMESTAMP ;
This will add a field called date which will record the date and time that the value was entered. Then when you pull the data using a SELECT command, use ORDER BY date DESC at the end of the query. So to pull the 5 most recent, Use:
SELECT * FROM jos_afm_cats ORDER BY date DESC Limit 5;
buddylee17
Practically a Master Poster
697 posts since Nov 2007
Reputation Points: 232
Solved Threads: 137
I agree with buddylee17. Without having a timestamp field or an autoincrement field, you can't make out which record was added last.
Edit: you can make use of rowid (i think)
nav33n
Purple hazed!
4,465 posts since Nov 2007
Reputation Points: 524
Solved Threads: 356
I agree with buddylee17. Without having a timestamp field or an autoincrement field, you can't make out which record was added last.
Edit: you can make use of rowid (i think)
I think you can use row cat_id (`cat_id` int(11) NOT NULL auto_increment).
maybe you can order it like this
SELECT * FROM 'jos_afm_cats' ORDER BY 'cat_id' ASC;
rudevils
Junior Poster in Training
80 posts since Jan 2008
Reputation Points: 10
Solved Threads: 10
I think you can use row cat_id (`cat_id` int(11) NOT NULL auto_increment).
Oops! I didn't see that OP has an auto increment field.maybe you can order it like this
SELECT * FROM 'jos_afm_cats' ORDER BY 'cat_id' ASC;
And yep, that's what I was talking about.
nav33n
Purple hazed!
4,465 posts since Nov 2007
Reputation Points: 524
Solved Threads: 356