title: joining mySQL tables with some rows being different
body: <p>I have 2 different tables in a mySQL database that are structured like this:</p>
  
  <pre><code>table_cart:
  
  cart_id | item_id | quantity
  ----------------------------
  00001     285       1
  00002     482       2
  00003     683       6
  00004     627       1
  
  table_products:
  
  product_id  |  product_name    |   quantity
  -------------------------------------------
  285            some name           50
  482            another name        40
  683            one more name       35
  627            yet another name    80
  </code></pre>
  
  <p>What I am trying to display is 2 things from table_cart (the item_id and the quantity) and 1 thing from table_products (the name). The problem is, when it grabs the quantity with my code, it chooses the one from table_products, which is not the one I need. I imagine I did something wrong with the joining of the tables but I tried INNER, LEFT, RIGHT, etc. and none is working.</p>
  
  <p>My query is like this:</p>
  
  <pre><code>$product_rows = $this-&gt;query("
  SELECT * FROM table_cart INNER JOIN table_products 
  ON table_cart.item_id=table_products.product_id 
  WHERE cart_id='".$cart_id."'"
  ");
  </code></pre>
  
  <p>And I then output it like:</p>
  
  <pre><code>$item_details = mysql_fetch_array($product_rows);
  
  $item_details['item_id']
  $item_details['name']
  $item_details['quantity']
  </code></pre>
  
  <p>What am I doing wrong?</p>