title: prepared statements execute multiple queries at once
body: <p>I have been trying this for hours and still no luck. Simply I am deleting rows from two tables using checkboxes. Let's assume I have checked two results and hit delete, then those two rows should be deleted from both tables. </p>
  
  <p>In the below code the first query deletes two rows but the second one only deletes one row. If I just run each query separately then they both delete two rows? I have tried many times but I am not able to achieve what I wanted.</p>
  
  <p>Can someone pleaseeee tell me why each query is failing to delete two rows? or is there a better way to do this? some kind of alternative?</p>
  
  <pre><code>  $stmt1  = $mydb-&gt;prepare("DELETE from laptop where username = ? and id = ?");
  echo $mydb-&gt;error;
  foreach  ($_POST['id'] as $id)
  {
  $stmt1-&gt;bind_param('ss', $username-&gt;username, $pdata);
  $stmt1-&gt;execute();
  }
  
  $stmt2  = $mydb-&gt;prepare("DELETE from search where username = ? and id = ?");
  echo $mydb-&gt;error;
  foreach  ($_POST['id'] as $id)
  {
  $stmt2-&gt;bind_param('ss', $username-&gt;username, $id);
  $stmt2-&gt;execute();
  }
  </code></pre>