title: Code Igniter Count Function
body: <p>What I want to do is I want to count the total records from the table called "songs_tbl" from my database. So I wrote this function in controller.</p>
  
  <pre><code>private function getHeaderInfo()
  {
           $total_songs = $songs-&gt;count('distinct songs_tbl.song_id');
           $this-&gt;mysmarty-&gt;assign('total_songs',$total_songs);
  }   
  </code></pre>
  
  <p>I got this error </p>
  
  <blockquote>
    <p><strong>Fatal error: Call to a member function count() on a non-object in</strong></p>
  </blockquote>
  
  <p>Any suggestion ? Thank you.</p>
  
  <p>With Regards,</p>