dear chris,

mysql does not support 'in' clause at the momment...
the only way to this is to use the loop to generate the sql syntax..
orr.. use the implode function... to join the array into 1 string separated by
the first parameter...

$catsql = implode("or cid=", $catids);
$catsql  = ((strlen(catsql)>0)? substr(catsql, 3, strlen(catsql)): "");

$catsql = "select * from categories where " . $catsql;

Chris Lott wrote:

> I have an array of id numbers ($catids). I would like to select from the
> mysql database all records where cid is in that array.
>
> This syntax fails:
> select * from categories
> where cid in $catids
>
> What is the correct way to do this? It can be done outside of a loop, can't
> it?
>
> c


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to