What is the trick in MySql (Version 4) to write from PHP thtree Inserts and to be sure that we can link tables properly.
[Table1]-[LinkTable]-[Table2]
In the PHP code I create an Insert that add 1 row in table 1 and an other Insert that add an other row in table 2. I get both rows PK (primary key) with two SELECTs that return me the last row of each tables. This way I get the PK (auto-increment) from Table 1 and Table 2 and I insert it on the link table.
The problem is that is not atomic and now that I get a lot of transaction something it doesn't link properly.
How can I make a link between 2 tables in MySQL 4 that preserve data? I cannot use any stocked procedure.