title: Return data from Database where data is repeated
body: <p>sorry to bother you guys, but been trying everything i could to get some data from database, and all the time it show's me blank, so i'm getting blank flashes as well :)</p>
  
  <p>So what i need to to is,</p>
  
  <p><img src="https://i.stack.imgur.com/flGJN.png" alt="database data"></p>
  
  <p>as you see on the pic, i have a column ownerId with repeated data, this is ok, i work's like that, now what i want extract from the database is to show the itemId and count where ownerId = ?.</p>
  
  <p>So have my query as bellow.</p>
  
  <pre><code>&lt;table id="zctb" class="display table table-striped table-bordered table-hover" cellspacing="0" width="100%"&gt;
  &lt;thead&gt;
      &lt;tr&gt;
              &lt;th&gt;#&lt;/th&gt;
              &lt;th&gt;Item Name&lt;/th&gt;
              &lt;th&gt;Item ID&lt;/th&gt;
              &lt;th&gt;Quantity&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  
  &lt;tbody&gt;
  
  &lt;?php   
  $sql = "SELECT ownerId, itemId, count from user_item where ownerId = :editid";
  $query = $dbh2 -&gt; prepare($sql);
  $query-&gt;bindParam(':editid',$editid,PDO::PARAM_INT);
  $query-&gt;execute();
  $result=$query-&gt;fetch(PDO::FETCH_ASSOC);
  $cnt=1; 
  
  if($query-&gt;rowCount() &gt; 0){
      foreach($results as $result){               
  ?&gt;  
              &lt;tr&gt;
                  &lt;td&gt;&lt;?php echo htmlentities($cnt);?&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;?php echo htmlentities($result-&gt;item_name);?&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;?php echo htmlentities($result-&gt;itemId);?&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;?php echo htmlentities($result-&gt;count);?&gt;&lt;/td&gt;
              &lt;/tr&gt;
  &lt;?php 
          $cnt=$cnt+1; 
      }
  } 
  ?&gt;
  
          &lt;/tbody&gt;
      &lt;/table&gt; 
  </code></pre>
  
  <p>but this don't return anything not even not data found on the table.</p>
  
  <p>any idea?</p>