title: mysql: Inserting multiple 'insert into' requests
body: <p>I am trying to use 2 separate <code>insert into</code> statements to create 1 row. Since the row uses data from another table (ingredients) AND uses data from a submitted post (the meals name), I am trying to combine the two, so I can create 1 new row with extra data in it.</p>
  
  <p>The problem i'm running into is mysql syntax errors. Is there a way I can use the post data AND the data from my ingredients table to make a new row? </p>
  
  <p>It seems like you can only have <code>insert into .. select</code> OR <code>insert into .. values</code>, but you can't have both!</p>
  
  <pre><code>// Added Ingredients to a Meal
  if (isset($_POST['add_ingredient'])){
      $meal = (string)$_POST['meal_names'];
      $ingr = (string)$_POST['ingredients_list'];
  
  
  $sql = "INSERT INTO meal_ingredients (quanity, package, cost, store, item)
          SELECT quanity, package, cost, store, item
          FROM ingredients;
          INSERT INTO meal_ingredients (meal)
          VALUES ('$meal')";
  
      if ($conn-&gt;query($sql) === TRUE) {
      echo "New record created successfully.";
      }   
      else {
      echo "Error: " . $sql . "&lt;br&gt;"  . $conn-&gt;error;
      }
  }
  </code></pre>