[development] D7 Query placeholders and values

Michael Prasuhn mike at mikeyp.net
Wed Aug 26 18:24:06 UTC 2009

I don't know what you are trying to do, but it would probably be  
better served by a dynamic query, using the values() method.

Could you post an example of the whole query, and the code to build  
the arguments?


Michael Prasuhn
503.512.0822 office
mike at mikeyp.net

On Aug 26, 2009, at 2:11 PM, Nancy Wichmann wrote:

> Since I see Larry Garfield has looked at this list today, I thought  
> I would ask this now since I just had this come up.
> I know about the new ":label" for substitution in D7 and have no  
> problem with that. But what do I do with an array of values, as in:
>   $types = variable_get('my_types_list', array());
>   $args += $types;
>   $result = db_query(..., $args);
> Yes, I properly used db_placeholders to set the "%s" values in  
> place. The query works fine in D6, it's just that I am already  
> looking at teh upgrade and wondered about how to do arrays of values  
> like this, when I can't go in and add a label to them.
> Nancy E. Wichmann, PMP
> Injustice anywhere is a threat to justice everywhere. -- Dr. Martin  
> L. King, Jr.

More information about the development mailing list