[PHPwestoz] getting the last inserted id in mysql

Timothy White weirdo at tigris.org
Tue Feb 22 22:59:02 UTC 2005


Mike Fewings wrote:

> Hi all,
>
>>
>> Unfortunately I don't know any function in MySQL that lets you
>> retrieve the auto-increment ID of a field you just created. You
>> normally have to do another select, which is not hard if you do this:
>> "SELECT ID FROM Artists ORDER BY ID DESC LIMIT 1" This will give you
>> the last created ID, which normally would be the last record you
>> created.
>
>
>
> This function can retreive the last insert id from the database
>
>                select last_insert_id() as feild_id

Nice. Thanks
(I assume it should be field_id?)

Tim

--
Tim White - Use the Fox, Luke!
PGP/GPG id: 602E944D, Pub Key Serv: subkeys.pgp.net
Fingerprint: 04C2 9682 B7B2 3006 009D  A9F3 067E EDCD 602E 944D
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!
--

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.linux.org.au/pipermail/phpwestoz/attachments/20050222/58017dbf/attachment.pgp 


More information about the PHPwestoz mailing list