title: PHP Like System / 'Most Liked' (Need for logic)
body: <p>I'am trying create a basic comment system, I was success but I have a problem right now.</p>
  
  <p>I can't list "most liked" comments and I don't have an idea about how can I.</p>
  
  <p>My <strong>votes database</strong> showing like that:</p>
  
  <pre><code>voteid  | value     | entryid   | userid
  25      | like      | 257       | 17
  24      | like      | 257       | 17
  23      | unlike    | 257       | 18
  </code></pre>
  
  <p>I create a new like with this code:</p>
  
  <pre><code>    $vote = $connect-&gt;prepare("INSERT INTO votes (entryid, userid, value) VALUES (:entryid, :userid, :value)");
      $vote-&gt;bindParam(':entryid', $entryid);
      $vote-&gt;bindParam(':userid', $userid);
      $vote-&gt;bindParam(':value', $value);
      $vote-&gt;execute();
  </code></pre>
  
  <p>And my question.</p>
  
  <p><strong><em>What's my need SQL Query</em></strong>? </p>
  
  <p>I've tried like this:</p>
  
  <pre><code>  $bestliked = $connect-&gt;prepare("SELECT * FROM votes");
    $best = $bestliked-&gt;fetchAll(PDO::FETCH_GROUP|PDO::FETCH_COLUMN, 2);
  </code></pre>
  
  <p>But I can't list the array which have most subarray. It only seems that;</p>
  
  <pre><code>[1] =&gt; Array
      (
          [0] =&gt; 8
          [1] =&gt; 2
          [2] =&gt; 3
          [3] =&gt; 4
          [4] =&gt; 5
          [5] =&gt; 6
          [6] =&gt; 7
          [7] =&gt; 9
          [8] =&gt; 10
          [9] =&gt; 11
          [10] =&gt; 12
          [11] =&gt; 13
          [12] =&gt; 14
          [13] =&gt; 15
      )
  
  [2] =&gt; Array
      (
          [0] =&gt; 16
      )
  
  [3] =&gt; Array
      (
          [0] =&gt; 17
      )
  </code></pre>
  
  <p>Thanks All!</p>