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
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
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
you have just one result, the last (biggest) ID number.
>
>
>Niklas
>
>
>-Original Message-
>From: hugh danaher [mailto:[EMAIL PROTECTED]]
>Sent: 18. tammikuuta 2002 7:37
>To: Php-General
>Subject: [PHP] Getting the last record in a mysql table
>
>
&g
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
Sent: 18. tammikuuta 2002 7:37
To: Php-General
Subject: [PHP] Getting the last record in a mysql table
Help!
I thought this would be easy but it ain't. What I want is the id number
of the last record in a table. I've tried a number of variations to the
following but am getting no wher
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
> 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
Help!
I thought this would be easy but it ain't. What I want is the id number of the last
record in a table. I've tried a number of variations to the following but am getting
no where! Any help will be greatly appreciated.
Hugh
$results=mysql_query(" SELECT last_insert_id() FROM MY_TABLE ")
9 matches
Mail list logo