[support] db_select()->condition()

Earnie Boyd earnie at users.sourceforge.net
Thu May 24 20:28:11 UTC 2012


I have an existing module I'm trying to convert to DBTNG and have a
condition I need a suggestion on.

Original statement is something like
SELECT mt.myvar FROM {mytable} mt WHERE mystring LIKE '%%%s%%';

I want to change it to
db_select('mytable', 'mt')
  ->fields('mt', array('myvar'))
  ->condtion('mystring', '%:mystring%', LIKE)
  ->execute();

The problem is condition() only takes three parameters, what would you
suggest to use to replace :mystring?  I'm using t() but that seems
like a misuse of it.

-- 
Earnie
-- https://sites.google.com/site/earnieboyd


More information about the support mailing list