title: Php pdo result of JOIN query
body: <h2>My problem is</h2>
  
  <p>I try to do a simple JOIN between two tables, that both have the id field. My result is an stdClass object, as I use PDO. Does anyone know how can I make a difference between the id of the first table and the id of the second table? </p>
  
  <h2>Code</h2>
  
  <pre><code>$sql = "SELECT * FROM products AS p 
          products_categories AS c 
          WHERE c.id = p.category";
  
  $stmt = $connection-&gt;prepare($sql);
  $stmt-&gt;execute();
  
  $products = array();
  
  while($product = $stmt-&gt;fetchObject())
      $products[] = $product;
  
  return $products;
  </code></pre>
  
  <p>If I try to use $products->id, it will show me the id of the <em>category</em> table. If it was an array, I could use $products['p.id'] , I need an alternative to this.</p>
  
  <p>Thanks a lot.</p>