Hi to All.
I have this code:

$query = " SELECT *FROM tabela WHERE persons LIKE '%$search%'

For example I have row in persons column which contains "John William Smith"
If I type in search filed "John William" or "William Smith" it will return result. But how to make to return result if I type "John Smith" in search box.

$search = join('%', explode(' ', $search));
/*
 For Example:
   search = 'John Smith';
   search = join('%', explode(' ', search));
   search now = John%Smith
*/

good logic ShawnCplus :)
short n sweet, i liked it..!!
thnx

Wow, I can't believe I suggested that. That is insanely slow and stupid, sorry. Just do

$search = str_replace(' ', '%', $search);

Wow, I can't believe I suggested that. That is insanely slow and stupid, sorry. Just do

$search = str_replace(' ', '%', $search);

Perfect !

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.