title: MYSQL modeling relationships: Design and UPDATE/DELETE
body: <p>I am trying to understand relationships fully, and have gone through alot of tutorials. Still i linger on a few things (using MySQLWORKBENCH):
  <img src="https://i.stack.imgur.com/sZsdh.png" alt="enter image description here">
  1. Every user can upload a product
  2. Every product can have multiple categories, bids, ratings, etc
  3. Every user can have multiple phonenumbers
  (there are more, but this is the basic setup)</p>
  
  <p><strong>Is this correct?:</strong>
  1 - I used a 1:n relationship, since every user can upload multiple products.
  2 and 3. I used n:m relationship, since there can be multiple products with multiple categories, bids, ratings, etc.</p>
  
  <p><strong>DELETE/UPDATE:</strong>
  I used ON UPDATE CASCADE and ON DELETE CASCADE everywhere where there is a foreign key...that being 'product', 'category_tags_has_products', 'bid_price_has_product', 'phone_has_user'.</p>
  
  <p>I tried to delete a product like this (php): mysql_query("DELETE FROM product WHERE id='$id'"); 
  I get a 1054 error, which is a foreign key error. 
  What are the best practises here? It is to my understanding that i shouldn't need to do deletions in any other than the parent-table?</p>
  
  <p>Thanx!</p>