You are here: Re: getting ID field (autoinc) « MySQL Databases « IT news, forums, messages
Re: getting ID field (autoinc)

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация