RE: [PHP] Getting the last record in a mysql table FINALLY!!

2002-01-18 Thread Chris Schneck
his should print out whatever the primary key # of the last insert query performed. This help at all? >From: Niklas Lampén <[EMAIL PROTECTED]> >Reply-To: <[EMAIL PROTECTED]> >To: "Php-General" <[EMAIL PROTECTED]> >Subject: RE: [PHP] Getting the last record

RE: [PHP] Getting the last record in a mysql table FINALLY!!

2002-01-17 Thread Niklas Lampén
Well, ofcourse you have to have the table + field names right. ;) Niklas -Original Message- From: hugh danaher [mailto:[EMAIL PROTECTED]] Sent: 18. tammikuuta 2002 9:38 To: [EMAIL PROTECTED] Cc: Php-General Subject: Re: [PHP] Getting the last record in a mysql table FINALLY

Re: [PHP] Getting the last record in a mysql table FINALLY!!

2002-01-17 Thread hugh danaher
TED]> To: Php-General <[EMAIL PROTECTED]> Sent: Thursday, January 17, 2002 10:29 PM Subject: RE: [PHP] Getting the last record in a mysql table > If you have ID that is a incrementing number, you could just query like > this: > 'SELECT ID FROM MY_TABLE ORDER BY ID DESC, LIMI

Re: [PHP] Getting the last record in a mysql table

2002-01-17 Thread Alex Chau
Another option under same condition is: 'SELECT MAX(ID) AS LASTID FROM MY_TABLE' Alex Chau Niklas Lampén wrote: >If you have ID that is a incrementing number, you could just query like >this: >'SELECT ID FROM MY_TABLE ORDER BY ID DESC, LIMIT 1' > >And there you have just one result, the last (

RE: [PHP] Getting the last record in a mysql table

2002-01-17 Thread Niklas Lampén
You're welcome. Heh, why to make too hard. :) Niklas -Original Message- From: hugh danaher [mailto:[EMAIL PROTECTED]] Sent: 18. tammikuuta 2002 8:40 To: [EMAIL PROTECTED] Subject: Re: [PHP] Getting the last record in a mysql table Niklas, Now that sounds like a solution! T

RE: [PHP] Getting the last record in a mysql table

2002-01-17 Thread Niklas Lampén
If you have ID that is a incrementing number, you could just query like this: 'SELECT ID FROM MY_TABLE ORDER BY ID DESC, LIMIT 1' And there you have just one result, the last (biggest) ID number. Niklas -Original Message- From: hugh danaher [mailto:[EMAIL PROTECTED]] Sent: 18. tammik

Re: [PHP] Getting the last record in a mysql table

2002-01-17 Thread hugh danaher
D]> To: 'hugh danaher' <[EMAIL PROTECTED]>; Php-General <[EMAIL PROTECTED]> Sent: Thursday, January 17, 2002 9:40 PM Subject: RE: [PHP] Getting the last record in a mysql table > > I thought this would be easy but it ain't. What I want is > > the

RE: [PHP] Getting the last record in a mysql table

2002-01-17 Thread Jason Murray
> I thought this would be easy but it ain't. What I want is > the id number of the last record in a table. If you use mysql_num_rows() and decrement it by one, you'll have the ID of the row you can use with mysql_result. Jason -- PHP General Mailing List (http://www.php.net/) To unsubscrib