title: Get row count from SQLite
body: <p>I am trying to get a row count from sqlite for my android application but for some reason its always returning Zero even though I have a enough amount of rows in my DB.</p>
  
  <p>Here is the Code:</p>
  
  <pre><code>DatabaseConnector database1 = new DatabaseConnector(getApplicationContext());
  int TotalPosts = database1.getIds();
  
  
   public int getIds()
         {
             String selectQuery = "SELECT COUNT(Pst_id) AS CountTotal FROM student_posts";           
             SQLiteDatabase database = this.dbOpenHelper.getReadableDatabase();
             Cursor c = database.rawQuery(selectQuery, null);     
             count = c.getColumnIndex("CountTotal");    
             return count;
         }
  </code></pre>
  
  <p>Thanks.</p>