codeigniter query builder order by code example

Example 1: codeigniter where_not_in

$names = array('Frank', 'Todd', 'James');
$this->db->where_not_in('username', $names);
// Produces: WHERE username NOT IN ('Frank', 'Todd', 'James')

Example 2: codeigniter query builder order by

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

Example 3: cideigniter orLike()

$this->db->like('title', 'match'); $this->db->or_like('body', $match);
// WHERE `title` LIKE '%match%' ESCAPE '!' OR  `body` LIKE '%match%' ESCAPE '!'

Tags:

Php Example