Is there any way to show only one decimal using select_avg()
in CodeIgniter?
$this->db
->select_avg('Stars')
->from('Reviews')
$query=$this->db->get();
return $query->result();
Is there any way to show only one decimal using select_avg()
in CodeIgniter?
$this->db
->select_avg('Stars')
->from('Reviews')
$query=$this->db->get();
return $query->result();
Try like this
$this->db->select_avg(ROUND('Nr_stele'))->from('Recenzii as r');
$query = $this->db->get();
return $query->result_array();
Check SQL
ROUND()
Function and$this->db->select_avg()
in codeigniter