title: PDO fetchall query, show multiple results but only 1 per ID
body: <p>My question wasn't clear so I'm editing a bit.</p>
  
  <p>I have a website where people can bid on stuff and on their account page they can track there bids. But if one person bids twice on a product they see that product twice. So I only want to show there highest bid per product.</p>
  
  <p>This is my query:</p>
  
  <pre><code>$objDatabaseAds-&gt;prepare('SELECT * FROM bieden WHERE ownerid = :ownerid ORDER BY prijs DESC');
  </code></pre>
  
  <p>Greetings,</p>
  
  <p>Bram</p>
  
  <p>EDIT</p>
  
  <pre><code>$objGetHighest = $objDatabaseAds-&gt;prepare('SELECT * FROM bieden WHERE ownerid = :ownerid GROUP BY adid');
  $objGetHighest-&gt;bindParam('ownerid', $member_id);
  $objGetHighest-&gt;execute();
  $objGetHighestFetch = $objGetHighest-&gt;fetchAll(PDO::FETCH_ASSOC);
  
  foreach ($objGetHighestFetch as $key) {
    $adID = $key['adid'];
    //This echoes 3 values which is good!!
  
    $objGetBid = $objDatabaseAds-&gt;prepare('SELECT * FROM bieden WHERE adid = :adid');
    $objGetBid-&gt;bindParam('adid', $adID);
    $objGetBid-&gt;execute();
    $objGetBidFetch = $objGetBid-&gt;fetchAll(PDO::FETCH_ASSOC);
  }
  </code></pre>
  
  <p>So this is what I got right now. The $adID echoes 3 values out of the 4 ads where 2 of them have the same ID so this is good. But then I do another query and then I get then I see the bids of the ID which he shows once.</p>
  
  <p><a href="https://i.stack.imgur.com/darM2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/darM2.png" alt="Table"></a> </p>