Hi,
I have to insert values into two tables, one of them making a reference to the other:
First Table
ID
...
Second Table
ID
first_table_id
when I insert in the second table, I have to add a new entry also to the first table (it works as objects, the two tables being a single object, and the first table being more general than the second table).
So when I add a new object, I have to add an entry to the first table, then to the second table.
But here comes the problem (at last :-D):
How can I know the value of the ID in the first table, since I used an auto-increment field??? I need to put this in the second table...
So is it possible to output the result of a query?
Or should I first find the highest ID (let's call it $MAX1), and NOT use the auto-increment feature, but use $MAX + 1 as the ID: this way I would know what the ID is...
Do you know a better way?