By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,722 Members | 1,381 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,722 IT Pros & Developers. It's quick & easy.

Mysql result

P: n/a
I have a php script that insert database record into the mysql
database, the primary key of the table is auto incremented. how do i
get the primary key of the last record entered?

thanks and regards

Jorn
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
In article <e9**************************@posting.google.com >,
jo****@yahoo.com (jo****@yahoo.com) wrote:
I have a php script that insert database record into the mysql
database, the primary key of the table is auto incremented. how do i
get the primary key of the last record entered?

thanks and regards

Jorn


Either from within MySQ: "SELECT LAST_INSERT_ID()", or with the built-in
PHP function mysql_insert_id(). Warning: the PHP function gives
incorrect results if the id is of type BIGINT.

See <http://nl.php.net/manual/en/function.mysql-insert-id.php>.

JP

--
Sorry, <de*****@cauce.org> is een "spam trap".
E-mail adres is <jpk"at"akamail.com>, waarbij "at" = @.
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.