title: Delete from multiple tables having common field
body: <p>Hi I have two tables as per following.....</p>
  
  <p>tbl_favorite_properties</p>
  
  <p>1 favorite_properties_id</p>
  
  <p>2 favorite_properties_property_id</p>
  
  <p>3 favorite_properties_user_id</p>
  
  <p>tbl_property</p>
  
  <p>1  property_id</p>
  
  <p>2  property_user_id</p>
  
  <p>Now i want to delete fields based on user which is straight forward as below</p>
  
  <pre><code>$user_id = $_SESSION['user_id'];
  
  $delete_tbl_favorite_properties = $con-&gt;prepare("DELETE FROM tbl_favorite_properties WHERE favorite_properties_user_id='$user_id'");
  $delete_tbl_favorite_properties-&gt; execute();
  
  $delete_tbl_property = $con-&gt;prepare("DELETE FROM tbl_property WHERE property_user_id='$user_id'");
  $delete_tbl_property-&gt; execute();
  </code></pre>
  
  <p>Now I want to delete all properties in tbl_favorite_properties (favorite_properties_property_id) which match this users properties in tbl_property (property_id)</p>
  
  <p>I am already able to do this in innodb cascade delete using mysql, but need a php solution.</p>
  
  <p>there is a solution here <a href="https://stackoverflow.com/questions/18381529/how-do-i-delete-row-with-primary-key-using-foreign-key-from-other-table">How do I delete row with primary key using foreign key from other table?</a></p>
  
  <p>but there the column names are the same and mine are different...</p>
  
  <p>i am new to structuring queries in multiple tables...</p>