Re: Mysql Query Question

From: Date: Tue, 18 Mar 2003 21:13:38 +0000
Subject: Re: Mysql Query Question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-140195@lists.php.net to get a copy of this message
$string = "'" . implode("','",$group) . "'"; $query = "SELECT * FROM table WHERE groupname IN ($string)"; ---John Holmes... ----- Original Message ----- From: "Van Andel, Robbert" <RVanAndel@chartercom.com> To: <php-general@lists.php.net> 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

« previous php.general (#140195) next »