title: wordpress count rows that are same in custom table
body: <p>I have a custom table within my wordpress database. I would like to COUNT the rows in the table that have the same value.</p>
  
  <p>So for example:</p>
  
  <p>IP ADDRESS</p>
  
  <p>0.0.0.0.0</p>
  
  <p>0.0.0.0.1</p>
  
  <p>0.0.0.0.0</p>
  
  <p>The output would then be:</p>
  
  <p>there are 2 x 0.0.0.0.0</p>
  
  <p>there are 1 x 0.0.0.0.1</p>
  
  <p>I can achieve the above fine with a normal sql query, but i am trying to do this via the $wpdb class</p>
  
  <p>Here is my query:</p>
  
  <pre><code>$table =  $wpdb-&gt;prefix . 'wplt';
  
  $posts = $wpdb-&gt;get_results("SELECT ip_address, COUNT(ip_address) FROM $table GROUP BY ip_address");
  
  foreach ( $posts as $post ) {
  
      echo $post-&gt;ip_address;
  
      echo $post-&gt;COUNT(ip_address);
  
  }
  </code></pre>
  
  <p>With the above i get the following error:</p>
  
  <blockquote>
    <p>Fatal error: Call to undefined method stdClass::COUNT()</p>
  </blockquote>