[support] db_select()->condition()

Jamie Holly hovercrafter at earthlink.net
Wed Jul 11 20:24:08 UTC 2012


I've been noticing you replying with a lot of "junk" replies. If you no 
longer wish to receive emails from this list, then I suggest heading to 
the mailman page and unsubscribing:

http://lists.drupal.org/mailman/listinfo/support


Jamie Holly
http://www.intoxination.net
http://www.hollyit.net

On 7/11/2012 2:55 PM, Michael Tinney wrote:
> Junk
>
> Sent from my iPhone
>
> On Jul 11, 2012, at 2:53 PM, "Metzler, David" <metzlerd at 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 at drupal.org [mailto:support-bounces at drupal.org] On
> > Behalf Of Earnie Boyd
> > Sent: Wednesday, July 11, 2012 11:36 AM
> > To: support at 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 at 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/ ]




More information about the support mailing list