Databases: searching for a word in entries containing multiple words using 'like' |
I'm trying to set up a search using like to find words in a table column 'title'.
At first, I was using the following... Code: $this->db->like('title',$search); It worked fine, but I wanted to limit searches to the beginnings of words, so I'm using the following... Code: $this->db->like('title',$search,'after'); However, some entries might contain multiple words, so I want it to search for all words, not just the first word in an entry. For example, say I have the following entries... Art Art Therapy Driving Karts Participation Theory Of Art Writing Articles ...and I want the search term of 'art' just to return the following... Art Art Therapy Theory Of Art Writing Articles How do I achieve that? Will I have to resort to using a query with REGEXP? Unfortunately, I'm ashamed to say that regular expressions are something that I've never really got my head around! |
Welcome Guest, Not a member yet? Register Sign In |