cayley wrote:
> 
> $id = array( 1, 2, 3, 6, 10 );
> $sql = "select name from resource where id in ( ? )";
> 

Try this:

  $sql = $db->quoteInto("select name from resource where id in ( ? )", $id);

The quoteInto() method recognizes an array argument as a special case.  It
joins the values of the array together in a comma-separated list, and
substitutes that for the placeholder character.  This is useful in cases
like the one you describe.

Regards,
Bill Karwin
-- 
View this message in context: 
http://www.nabble.com/Passing-array-of-values-to-db-statement-tp15813319s16154p15813789.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to