RE: [PHP] Mysql Query Question

From: Date: Tue, 18 Mar 2003 21:16:25 +0000
Subject: RE: [PHP] Mysql Query Question
Groups: php.general 
Request: Send a blank email to php-general+get-140196@lists.php.net to get a copy of this message
Thanks, I knew it was something simple but I couldn't find it on the 'Net. Robbert van Andel -----Original Message----- From: CPT John W. Holmes [mailto:holmes072000@charter.net] Sent: Tuesday, March 18, 2003 1:14 PM To: Van Andel, Robbert; php-general@lists.php.net Subject: Re: [PHP] Mysql Query Question $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 (#140196) next »