I need to find the word L?mm?nmyyntipalvelut from the database. Only, in the database it is in a field, whose value has been a PHP array, converted into JSON using json_encode() and so the special characters are scrabled into hex unicode.
So my query is
SELECT * FROM table WHERE (services LIKE '%L?mm?nmyyntipalvelut%')
No results. No surprise. Next, query with special characters converted:
SELECT * FROM table WHERE (services LIKE '%Lu00e4mmu00f6nmyyntipalvelut%')
No results and I wonder why. Next I tested querying for only special character:
SELECT * FROM table WHERE (services LIKE '%u00e4%')
Found what was supposed to find. Next I started adding stuff (L to beginning) to see where it went wrong:
SELECT * FROM table WHERE (services LIKE '%Lu00e4%')
No results. Another test:
SELECT * FROM table WHERE (services LIKE '%u00e4mm%')
Found what was supposed to find.
So my conclusion is that the backslash is somehow messing things up, but I don't understand how?
EDIT:
Exact contents of services field:
["Neuvonta","Lu00e4mmu00f6nmyyntipalvelut",
"Metsu00e4-/energiapuunkorjuupalvelut"]
Exact query:
SELECT id, uid, company_name, services, logo FROM rekisteroeidy_toimijaks
WHERE
(services LIKE '%Lu00e4mmu00f6nmyyntipalvelut%' AND
services LIKE '%Metsu00e4-/energiapuunkorjuupalvelut%')
ORDER BY company_name ASC
I added some line breaks to help readability.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…