© David Powers 2019
David PowersPHP 7 Solutionshttps://doi.org/10.1007/978-1-4842-4338-1_18

18. Managing Multiple Database Tables

David Powers1 
London, UK

The previous chapter showed you how to use INNER JOIN and LEFT JOIN to retrieve information stored in multiple tables. You also learned how to link existing tables by adding an extra column to the child table and updating each record individually to insert a foreign key. However, most of the time you’ll want to insert data simultaneously in both tables. That presents a challenge, because INSERT commands can operate on only one table at a time. You need to handle the insert operations in the correct sequence, starting with the parent table, so that you can get the new record’s primary key and ...

Get PHP 7 Solutions: Dynamic Web Design Made Easy now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.