Welcome Guest, Not a member yet? Register   Sign In
Databases: searching for a word in entries containing multiple words using 'like'
#11

Okay, so, as my actual code involves a complicated JOIN and I couldn't get the SQL query to work, what I've ended up doing is the following:

Code:
$this->db->where('title LIKE ', $search.'%');
$this->db->or_where('title LIKE ', '% '.$search);
$this->db->or_where('title LIKE ', '% '.$search.'%');
$this->db->or_where('title LIKE ', '% '.$search.' %');



CI's inbuilt like and or_like seem to be pretty limited when it comes to arguments (before, after, both, none), but utilising where and or_where does the trick for my needs.

Thanks for all your help and suggestions pointing me in the right direction.
Reply


Messages In This Thread
RE: Databases: searching for a word in entries containing multiple words using 'like' - by JernauGurgeh - 05-18-2021, 10:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB