[eluser]Unknown[/eluser]
I'm trying to implement a search function into my database query. The IF statement is tripping me up. Can someone please help?
Code:
function get_all_records($search, $limit, $offset) {
$ret['records']=$this->db
->select('users.username, records.*')
->join('records', 'users.id = records.user_id')
->limit($limit, $offset);
if (strlen($search)) {
->like('title', $search);
}
->get('users')
->result();
$ret['num_rows']= $this->db
->count_all('records');
return $ret;
}