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

mysql_insert_id() & stored procedure

P: n/a
if my query is a regular INSERT, then mysql_insert_id() works as expected.

But if I use a Stored Procedure to do my insert, then mysql_insert_id() returns 0

How can I get a returned autoincrement (my primary key) when using a stored
procedure? Thanks.
Aug 19 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Aug 19, 1:17 pm, Fred <F...@notspam.notwrote:
if my query is a regular INSERT, then mysql_insert_id() works as expected.

But if I use a Stored Procedure to do my insert, then mysql_insert_id() returns 0

How can I get a returned autoincrement (my primary key) when using a stored
procedure? Thanks.
Try using the stored procedure itself to return the
inserted id or change the stored procedure by a
function -- I don't know if it is allowen in MySQL.

Also, the return value of the stored procedure can
be used to verify the integrity of the insert statement.

Regards,
DMW

Aug 19 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.