1

Have a really simpel wildcars search:

"SELECT firstname, lastname, email, text FROM members WHERE firstname LIKE '%$word%' OR lastname LIKE '%$word%' OR email LIKE '%$word%' OR text LIKE '%$word%'"

If I search for "test" it finds the words "test" but not "Test", how do i fix this? The weird thing is that in other another db it finds the words "Test" and "test", they are bout running "latin1_swedish_ci".

I thought the "COLLATE" statement would help, but i could not get it to work :(

user1671375
  • 269
  • 1
  • 3
  • 10

2 Answers2

0
"SELECT firstname, lastname, email, text FROM members WHERE UPPER(firstname) LIKE UPPER('%$word%') OR UPPER(lastname) LIKE UPPER('%$word%') OR UPPER(email) LIKE UPPER('%$word%') OR UPPER(text) LIKE UPPER('%$word%')"

try do it like this it will search after converting every text to upper case

rohitarora
  • 1,380
  • 2
  • 13
  • 20
0
"SELECT firstname, lastname, email, text 
FROM members 
WHERE upper(firstname) LIKE upper('%$word%') 
OR upper(lastname) LIKE upper('%$word%') 
OR upper(email) LIKE upper('%$word%') 
OR upper(text) LIKE upper('%$word%')"

"SELECT firstname, lastname, email, text 
FROM members 
WHERE lower(firstname) LIKE lower('%$word%') 
OR lower(lastname) LIKE lower('%$word%') 
OR lower(email) LIKE lower('%$word%') 
OR lower(text) LIKE lower('%$word%')"

this should work :)

ThePatBan
  • 107
  • 2
  • 15