From: "Aaron Wolski" <[EMAIL PROTECTED]>

> I have input for where users can enter order numbers in which to search
> the database to find results matching their entry.
>  
> To enter multiple order numbers they can comma separate like:
> 1,34,21,34,54
>  
> What I need to do is take those numbers and make a query that would like
> like:
>  
> (cart_id in('1','34','21','34','54') OR id in('1','34','21','34','54'))

Why do you need to put quotes around integers??

$var = '1,34,21,34,54';

//replace comma with quote,comma,quote and add quotes to beginning and end
$in_clause = "'" . str_replace(',',"','",$var) . "'";

$query = "WHERE (cart_id IN ($in_clause) OR id IN ($in_clause))";

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to