How can I perform a query with multiple LIKE parameters?
For example, I have this string to search through:
"I like searching very much"
This is the code I currently use:
$searTerm = "like"
$this->db->or_like('list.description', $SearchTerm,'both');
But I want to search with 2 or 3 parameters. like this:
$searTerm = "like";
$searTerm1 = "much";
How can I perform this to get the same result?
You can simply repeat the like
parameters on the active record. In your example you would do something like this:
$this->db->or_like('list.description', $searchTerm1);
$this->db->or_like('list.description', $searchTerm2);
$this->db->or_like('list.description', $searchTerm3);
...
This will just join each or_like
with an AND
in the WHERE
clause.