$string = "'" . implode("','",$group) . "'";
$query = "SELECT * FROM table WHERE groupname IN ($string)";

---John Holmes...

----- Original Message -----
From: "Van Andel, Robbert" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 18, 2003 3:51 PM
Subject: [PHP] Mysql Query Question


I am trying to query a database looking for results that match an array of
values I have set.

The variable array is call group and has about 10 elements.  Is there a way
that I can query the database using just $group instead of having to use the
following:
SELECT * FROM `table` WHERE groupname = '$group[1]' OR groupname='$group[2]'
OR groupname='$group[3].....

I think I saw the answer once before but can't find it anywhere.

Robbert van Andel




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

Reply via email to