title: How to select all orders from a specific customer using PHP and MySQL?
body: <p>I'm facing a problem when trying to select all the orders of a given client acessing the website and display them on the screen trhough a table. The problem is that the array that is being returned has the values ​​of the orders tripled (each order appears 3 times and not one). </p>
  
  <pre><code>$query = "SELECT orders.orderID, orders.date, products.name, products.price
     FROM ((orders
     INNER JOIN customers ON orders.userID = ?)
     INNER JOIN products ON orders.productID = products.productID)";
  
     $stm = $pdo-&gt;prepare($query);
     $stm-&gt;execute([$_SESSION['id']]); // The ID of the customer using the website
     $orders_array = $stm-&gt;fetchAll(PDO::FETCH_ASSOC);
  </code></pre>
  
  <p>My database has a customers table, a products table and an orders table. 
  I wanted the associative array to have the order id, product name, order date, and price, and in fact, all of this is being returned. However, it is being selected 3 times for each order. 
  I've searched on the internet for examples like this, but I could not find any examples that fit what I want. Does anyone have any idea why the values ​​are tripled</p>