Hi
is there an easy way to find the primary key of the last record you have just entered to a table?
and this is the senario: (I should say that all is about PHP and mysql)
I have 2 tables (or more). I enter a record to the first one and just then I need its primary key to enter it to another table (for relational purposes).
What I do now is like this:
first I insert the record to the first table.
then I make a query and find the largest primary key which is the one that I just added.
and at last I put that key in my second table (among the rest of data I need to put in second table.)
I guess there must be a more concise way so that I wouldn’t make the query in the middle.
if you know a better way please tell me and if you would do the same tell me so that I don’t search. (I am certain that if master experts here don’t know a way there is no chance for me to find it)
Thanks.