Search for a name from the database

I have a name in the database table mysql, for example Mohan Krishna . How can we search for this name using php with a search like mohankrishna name?

+4
source share
4 answers
 SELECT * FROM tablename WHERE LOWER(REPLACE(name,' ','')) LIKE LOWER('%mohankrishna%') 
+6
source

I'm not 100% sure, but may be a good approach.

One way is to use the full-text functionality of MySQL.

Another way using LIKE in your SELECT -query is exactly the same.

SELECT * FROM users WHERE username LIKE "mohankrishna";

But I am not very familiar with this, and I do not know how tolerant MySQL should give you an accurate record.

+1
source
 select * from table where where replace(name," ","") like '%mohankrishna%' 
+1
source

for example: SELECT column_1 from prefix_my_table WHERE column_2 LIKE '%Mohan%';

+1
source

All Articles