[support] db_select()->condition()

Jamie Holly hovercrafter at earthlink.net
Wed Jul 11 15:19:05 UTC 2012


Please refer to the list descriptions:

http://drupal.org/mailing-lists/

Support
A list for support questions.

Development
A list for Drupal core developers.

Earnie was asking a question for personal development and not core 
development, so currently he did ask in the right place. There has been 
past confusion on this and there is actually an issue on D.O. to try and 
get it resolved:

http://drupal.org/node/1163962

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

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.
> >
>
>
> I have just read an email to the developer list where you, I felt, were
> quite rude towards someone who, in your estimation, asked a question on
> the wrong list.
>
> Now I see a question of yours on what I suspect is the wrong list.
>
> According to the mailman page for the support list, "If you need help
> with getting Drupal up and running this is the list for you."
>
> It seems to me you are hacking on code, not trying to get Drupal up and
> running.
>
>
> It happens I agree with you on the distinction between the two lists, I
> asked a little while ago and this seemed to be the majority view.
>
> However, I would not reply to someone's question (or others' answers)
> just to castigate them for their stupidity.
>
> Now to your question:
> 1. The code you posted contains at least one typo. It has no prospect of
> working as you showed it.
> 2. Did you read this?
> http://api.drupal.org/api/drupal/includes!database!database.inc/function/db_select/7
>
>
>
>
>




More information about the support mailing list