Re: [PHP] most recent 5 rows

2001-08-08 Thread Richard Lynch
> Or, you could do two steps > > 1) retrieve the last inserted ID, with mysql_last_inserted_ID (or > something like that). > > 2) then, all records with id(s) greater then the_last_id_number minus > five. > > something like > > $most_recent = select mysql_last_id(); > > select * from TA

RE: [PHP] most recent 5 rows

2001-08-04 Thread John Monfort
t; > Jeff > > > -Original Message- > > From: Justin French [mailto:[EMAIL PROTECTED]] > > Sent: Saturday, August 04, 2001 6:09 AM > > To: [EMAIL PROTECTED] > > Cc: php > > Subject: Re: [PHP] most recent 5 rows > > > > > > Jeff Lewis wrote: >

Re: [PHP] most recent 5 rows

2001-08-04 Thread Justin French
Jeff Lewis wrote: > $sql = "SELECT * FROM news ORDER BY id DESC LIMIT 5"; many many many thanks for your (very quick) help!! Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact

RE: [PHP] most recent 5 rows

2001-08-04 Thread Jeff Lewis
ilto:[EMAIL PROTECTED]] > Sent: Saturday, August 04, 2001 7:06 AM > To: [EMAIL PROTECTED] > Cc: php > Subject: RE: [PHP] most recent 5 rows > > > It will give you the 5 HIGHEST values in your auto incremented > field. If it > was returneding the first 5, or

RE: [PHP] most recent 5 rows

2001-08-04 Thread Jeff Lewis
IL PROTECTED] > Cc: php > Subject: Re: [PHP] most recent 5 rows > > > Jeff Lewis wrote: > > > Try this SQL Justin: > > > > $sql = "SELECT * FROM news DESC LIMIT 5"; > > > Hrm, > > Won't that retrieve the FIRST 5 rows, not the LAST

Re: [PHP] most recent 5 rows

2001-08-04 Thread Justin French
Jeff Lewis wrote: > Try this SQL Justin: > > $sql = "SELECT * FROM news DESC LIMIT 5"; Hrm, Won't that retrieve the FIRST 5 rows, not the LAST 5? Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMA

RE: [PHP] most recent 5 rows

2001-08-04 Thread Jeff Lewis
Try this SQL Justin: $sql = "SELECT * FROM news DESC LIMIT 5"; Jeff > -Original Message- > From: Justin French [mailto:[EMAIL PROTECTED]] > Sent: Saturday, August 04, 2001 5:52 AM > To: php > Subject: [PHP] most recent 5 rows > > > Hi all, >

[PHP] most recent 5 rows

2001-08-04 Thread Justin French
Hi all, I have a table with the column "id", which is a unique number, auto-incremented, so the highest "id" is the most recent. I wish to retrieve the last five rows from the table (there will be hundreds of rows) and print some columns to the screen. I have this table: id,heading,text,use