Get a single table field value from database using CodeIgniter

If you want to get a single value from a database table, then an easy way to achieve that in CodeIgniter could be:


$count = $this->db->query('SELECT count(*) as count FROM departments')->row()->count;

Replace department by your table name, and of course, replace count(*) as count by your desired field.

Related searches:

  • codeigniter $this->db->count
  • codeigniter get db field
  • db codeigniter count
  • db->get field codeigniter
  • get single value from datatable in codeigniter
  • how to get a field in codeigniter
  • how to get field value of single field in codeigniter
  • rowcount codigniter
  • table count codeigniter

Leave a Reply