Junk
Sent from my iPhone
On Jul 11, 2012, at 2:53 PM, "Metzler, David" metzlerd@evergreen.edu wrote:
Well they say that your memory is the first thing to go.... I can't remember what the second is....
Dave
-----Original Message----- From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Earnie Boyd Sent: Wednesday, July 11, 2012 11:36 AM To: support@drupal.org Subject: Re: [support] db_select()->condition()
This is an old thread (May 24th) and answered to satisfaction some time ago. David, you responded then also.
On Wed, Jul 11, 2012 at 12:05 PM, Metzler, David metzlerd@evergreen.edu wrote:
I seem to be missing some of the messages on this thread, so I
apologize
if this question has already been answered more thoroughly.
You appear to be confusing db_query syntax with db_select. The query builder does not take tokens. This might help grok db_select.
db_select('mytable', 'mt') ->fields('mt', array('mycolumn')) ->condition('mycolumn', '%' . $mystring . '%', 'LIKE') ->execute();
Like is particularly confusing because it basically takes a regular expression inside the quotes.
Hope this helps... Dave
On 7/11/2012 6:30 AM, John Summerfield wrote:
Earnie Boyd wrote:
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.
-- [ Drupal support list | http://lists.drupal.org/ ] -- [ Drupal support list | http://lists.drupal.org/ ]
-- Earnie
-- https://sites.google.com/site/earnieboyd
[ Drupal support list | http://lists.drupal.org/ ]
[ Drupal support list | http://lists.drupal.org/ ]