Answers for "order by codeigniter 3"

PHP
1

codeigniter order by

$this->db->from($this->table_name);
$this->db->order_by("name", "asc");
$query = $this->db->get(); 
return $query->result();
Posted by: Guest on June-04-2020
0

codeigniter 3 order

$this->db->order_by('title', 'DESC'); 
// Produces: ORDER BY `title` DESC

$this->db->order_by('title DESC, name ASC');
// Produces: ORDER BY `title` DESC, `name` ASC

$this->db->order_by('title', 'DESC');
$this->db->order_by('name', 'ASC');
// Produces: ORDER BY `title` DESC, `name` ASC

$this->db->order_by('title', 'RANDOM');
// Produces: ORDER BY RAND()

$this->db->order_by(42, 'RANDOM');
// Produces: ORDER BY RAND(42)
Posted by: Guest on September-04-2021

Browse Popular Code Answers by Language