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

Getting MySQL Generated Keys

P: n/a
Hi,

I am a Java/JSP developer by trade but am currently developing a
MySQL/PHP solution.

In JSP when I run an INSERT statement on the db I am able to
automatically get back a list of any generated keys (without having to
do some sort of subsequent query to get the information).

Is there a PHP equivilent of this?

Thanks

Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
thehuby wrote:
I am a Java/JSP developer by trade but am currently developing a
MySQL/PHP solution.

In JSP when I run an INSERT statement on the db I am able to
automatically get back a list of any generated keys (without having to
do some sort of subsequent query to get the information).

Is there a PHP equivilent of this?


Unfortunately, as with all built in PHP database functions, there's no
database abstraction layer built into PHP which will do it for any
database, but for mysql you can use the mysql_insert_id() function.

http://www.php.net/mysql_insert_id

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
Jul 17 '05 #2

P: n/a
Cheers Chris that worked a treat!

Rick
<a href='http://www.e-connected.com'>Accessible Web Design by
eConnected</a>

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.