Re: SELECT problem..Need urgent help !!!!
| From: | Greg Donald | Date: | Mon, 29 Nov 2004 15:43:37 +0000 |
| Subject: | Re: SELECT problem..Need urgent help !!!! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-203063@lists.php.net to get a copy of this message | ||
On Mon, 29 Nov 2004 17:27:26 +0200, Phpu <phpu@go.ro> wrote:
> I have an array named $ex_array.
>
> I want to search the database and find those ids that are different from the values in
> $ex_array.
>
> I use this but didn't work
>
> $sql = "SELECT product_id FROM products WHERE product_id <> '$ex_array'
> " ;
$sql = "
SELECT
product_id
FROM
products
WHERE
product_id NOT IN ( "
. implode( ', ', $ex_array )
. " ) ";
This question would be more appropriate for the php-db list.
--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/