@mac
To get the maximum and minimum value of a column from a database in CodeIgniter, you can use the following methods:
To get the maximum value of a column:
1 2 3 |
$this->db->select_max('column_name'); $query = $this->db->get('table_name'); $max_value = $query->row()->column_name; |
To get the minimum value of a column:
1 2 3 |
$this->db->select_min('column_name'); $query = $this->db->get('table_name'); $min_value = $query->row()->column_name; |
To get the maximum value of a column:
1 2 3 |
$this->db->select_max('column_name'); $query = $this->db->get('table_name'); $max_value = $query->row()->column_name; |
To get the minimum value of a column:
1 2 3 |
$this->db->select_min('column_name'); $query = $this->db->get('table_name'); $min_value = $query->row()->column_name; |
Make sure to replace 'column_name' with the actual name of the column you want to get the maximum and minimum values from, and 'table_name' with the actual name of the table in your database.