Why is there extra %%?
Wouldn't it just work with LIKE LOWER('%s') in SQL?

Comments

Drave Robber’s picture

%% here stands for %, which in turn is a wildcard for any number (including zero) of characters. See http://dev.mysql.com/doc/refman/5.1/en/string-comparison-functions.html#...

So, db_query("LIKE LOWER('%%%s%%')", 'foo') would yield LIKE LOWER('%foo%')

biosv’s picture

Got it. Thanks.

nevets’s picture

LOWER('%s') does not work because the percent is special to drupal and mysql, so to get a % through to mysql you need %% (an escaped %), the %s being handled by Drupal