I Tried of making sort of names using Codeigniter but I found a problem, Please help me
Here is my data
- Doe Blablabla
- blablalba doe blablabla
- blablabla doe
- doe
I wanna sort it becomes like below but with some limit
- doe
- doe blablabla
- blablabla doe blablala
- blablabla doe
And here's my code, but the sort won't work yet
public function getFilter($name)
{
$this->db->select("*, (CASE people
WHEN people = '$name' THEN 1
WHEN people LIKE '$name%' THEN 2
ELSE 3
END) as people_name");
$this->db->from('citizen');
$this->db->like('people', $id);
$this->db->order_by("people_name asc");
$this->db->limit(2);
return $this->db->get()->result();
}