Welcome Guest, Not a member yet? Register   Sign In
Search a word in records
#1

Hi
I have many records that contain fields Title,ID,Code
I need search a word in Title fields
My example records is :

Title ID Code
1- Laptop Apple 1 2
2- Laptop Asus 2 3
3- Writer DVD 3 4
4- Top Website Template 4 5

Now
I need search "top" in this records
If use like,it return record 1,2,4
But i want to return only record 4,because i search only top word not parse of any word example laptop
How do i use query for this?
Reply
#2

Not sure if this will help but is a good start.

How To Improve Database Searches with Full-Text Search in MySQL 5.6 on Ubuntu 16.04
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

Use regex. Haven't tested with Query Builder, so can't give you an example with that.

Code:
mysql> SELECT 'a word a' REGEXP '[[:<:]]word[[:>:]]';   -> 1
mysql> SELECT 'a xword a' REGEXP '[[:<:]]word[[:>:]]';  -> 0
Reply
#4

(03-25-2018, 09:34 AM)jreklund Wrote: Use regex. Haven't tested with Query Builder, so can't give you an example with that.

Code:
mysql> SELECT 'a word a' REGEXP '[[:<:]]word[[:>:]]';   -> 1
mysql> SELECT 'a xword a' REGEXP '[[:<:]]word[[:>:]]';  -> 0

Yes it is working for me Thanks :heart
Reply




Theme © iAndrew 2016 - Forum software by © MyBB