How can I write the following SQL using CodeIgniter's query builder methods?
SELECT COUNT(*) AS total
FROM comments
WHERE `level`= 4
$this->db->select('count(*)');
$this->db->from('comments');
$this->db->where('level','4');
$query = $this->db->get();
echo $query->num_rows();