You are here: Re: Return an primary key value after insert query? « PHP Programming Language « IT news, forums, messages
Re: Return an primary key value after insert query?

Posted by David Haynes on 07/11/06 10:24

Julian Moorhouse wrote:
> Hi,
>
> I'm fairly new to mysql, but I have a reasonable knowledge of PHP.
>
> I just want to know is theres a simple way to return a primary key
> value for a record I've just inserted?
>
> In other environments I'd set a flag using the current time stamp which
> is inserted with the record.
>
> Then I'd select on that timestamp and get the primary key value.
>
> Is there a simpler way?
>
> Jules.
>
If your primary key is made using AUTO_INCREMENT, you may use the
mysqli_insert_id function.

http://ca.php.net/manual/en/function.mysqli-insert-id.php

-david-

 

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

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