title: mysql insert to multiple tables
body: <p>The database consist of four tables, customers, orders, order_item and products. currently customers table consist of 2 customers and products table consist of 4 products. lets say cutomer_id: 1, has product_id:1 and product_id:2 in cart.</p>
  
  <p>How can I insert the information both to table orders and order_item where order gets the full name of the customer and customer_id and order_items gets the key of order_id </p>
  
  <p>customers:</p>
  
  <pre><code>+-------------+------------+-----------+----------+
  | customer_id | first_name | last_name | city     |
  +-------------+------------+-----------+----------+
  |       (PK)1 | Joe        | Katz      | Brooklyn |
  |       (PK)2 | Mike       | Smith     | Brooklyn |
  +-------------+------------+-----------+----------+
  </code></pre>
  
  <p>Orders:</p>
  
  <pre><code>| order_id | customer_id | order_status | customer_name |
  +----------+-------------+--------------+---------------+
  |   (PK)   | (FK)        |             |                |
  +----------+-------------+--------------+---------------+
  </code></pre>
  
  <p>order_item:</p>
  
  <pre><code>+---------+----------+------------+----------+------------+
  | item_id | order_id | product_id | quantity | list_price |
  +---------+----------+------------+----------+------------+
  |  (PK)   | (FK)     |  (FK)      |          |            |
  +---------+----------+------------+----------+------------+
  </code></pre>
  
  <p>products:</p>
  
  <pre><code>+------------+--------------+------------+
  | product_id | product_name | list_price |
  +------------+--------------+------------+
  |      (PK)1 | jeans        |         45 |
  |      (PK)2 | shoes        |        100 |
  |      (PK)3 | socks        |          7 |
  |      (PK)4 | coat         |        160 |
  +------------+--------------+------------+
  </code></pre>