php - Problem with auto increment primary key (MySQL) -


I have 2 tables that use the primary key of the foreign key as the primary key for both Auto_increment .

The problem is, when I try to create and enter one in a table, I do not know what the primary key is the entry and it can not detect that the other table has the foreign key What to put in the form What should I do? Do I leave auto_interpret altogether and make a unique identifier for each entry so that I can use it to complete the entries made? I am using PHP, if it is relevant thanks.

Every major database going forward provides a means to identify the record you have entered; The idea of ​​self-enhanced ID will not otherwise be very useful.

In MySQL, you can use mysql_insert_id () . See or wrap it around.


Comments