Posted by Andy Jeffries on 09/28/38 11:33
On Fri, 02 Dec 2005 10:01:11 -0600, Khai wrote:
> Let's say I have a table:
>
> id (autoinc)
> name_first (text)
> name_last (text)
>
> And let's say information is added with a php script on a web page.
>
> Is it possible to do the Insert, then an immediate select of the ID?
$lastid = mysql_insert_id();
Or, if you want the pure MySQL SQL statemebt:
SELECT LAST_INSERT_ID();
Cheers,
Andy
--
Andy Jeffries | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos
[Back to original message]
|