Search with full name instead of just first name or last name

headshat1k

New Member
I am developing an API built with PHP and Codeigniter and I use MySQL as database.I have a user table called Users which contains the following columns:\[code\]- ID- Firstname- Lastname- Email\[/code\]How can a user search this table using a full name? For example it works fine to search either by Martin or Smith, but not Martin Smith.This is the query I am using now:\[code\]$this->db->select('*');$this->db->from('users');$this->db->like('firstname', $args['query']);$this->db->or_like('lastname', $args['query']);\[/code\]UpdateIf I use this query as suggested below I cannot find anything. Not with full name, first name or last name. Then both first name AND last name needs to be the same word.\[code\]$this->db->select('*');$this->db->from('users');$this->db->like('firstname', $args['query']);$this->db->like('lastname', $args['query']);\[/code\]
 
Top