0

Hi Guys, I am inserting values in two tables. After the insert of values in the first table, I want to get the inserted ID(first table) because I need that value in my second table.This is my code but I think it will gives error when there are many values inserted I am right? Or I should use mysql_insert_id()? Is it ok using mysql_insert_id()? Thank you

SELECT max(sampid) as sampid FROM sampinfo
3
Contributors
3
Replies
21
Views
2 Years
Discussion Span
Last Post by bLuEmEzzy
0

you should have generated an id for both tables before you insert the data.
because i think querying for max id is not the answer when you have more than 1 user using whatever it is you building.

2

mysql_insert_id used to be the way to do it. Now it.s the pdo or mysqli equivalent.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.