title: Insert data in multiple Mysql tables using single php form
body: <p>I have a form with data I will like to insert in 2 different tables (<code>order</code> and <code>order_etails</code>). Here is what I did. But it is inserting in only 1 form.</p>
  
  <pre><code>&lt;?php
  include '../db/connect.php';
  
  $sql="INSERT INTO order_etails (part_id, quantity, price, status_id,order_id)
    VALUES
          ('$_POST[part_id]','$_POST[quantity]','$_POST[price]','$_POST[status_id]','$_POST[order_id]     '),
  ('$_POST[part_id2]','$_POST[quantity2]','$_POST[price2]','$_POST[status_id2]','$_POST[order    _id2]'),
  ('$_POST[part_id3]','$_POST[quantity3]','$_POST[price3]','$_POST[status_id3]','$_POST[order    _id3]')";
  
  $sql1="INSERT INTO order (platform)
  VALUE
  ('$_POST[platform]')";
  
  if (!mysqli_query($con,$sql))
  {
  die('Error: ' . mysqli_error($con));
   }
  echo "record(s) added";
  
  mysqli_close($con);
  
  ?&gt;
  </code></pre>
  
  <p>I have also tried this:</p>
  
  <pre><code>&lt;?php
  include '../db/connect.php';
  
  
  $sql="INSERT INTO order_details (part_id, quantity, price, status_id,order_id)
  VALUES
  ('$_POST[part_id]','$_POST[quantity]','$_POST[price]','$_POST[status_id]','$_POST[order_id]'),
  ('$_POST[part_id2]','$_POST[quantity2]','$_POST[price2]','$_POST[status_id2]','$_POST[order_id2]'),
     ('$_POST[part_id3]','$_POST[quantity3]','$_POST[price3]','$_POST[status_id3]','$_POST[order_id3]');
  
  INSERT INTO order (platform)
  VALUE
  ('$_POST[platform]')";
  
  
  mysql_query($sql1);
  
  if (!mysqli_query($con,$sql))
  {
  die('Error: ' . mysqli_error($con));
  }
  echo "record(s) added";
  
  mysqli_close($con);
  
  ?&gt;
  </code></pre>