What is the best way to fill the record in two tables, which each have the context of each other's primary key?
My thoughts are either a "link" table between them, which once again has been written to DB or the population has once been populated by the following complex series of
Insert1 get identity1 Insert2 Update Update Update 2
How can you do it in PHP, when connected to a database and maintain integrity?
You will need to use the transaction, if so, can you go about doing this?
Can I ask why the tables need to reference each other? If this is straightforward 1: 1 then I suggest that throwing the foreign key in one of the table. Lookup is just as easy and your foreign key can be implemented properly otherwise you need to move in a chicken / egg landscape where the tables need to be referred to each other but first it needs to be made It is that at a certain point your database will be in a non-stable state.
Comments
Post a Comment