RE: [PHP-DB] In_Array in Query

From: Date: Wed, 23 Aug 2006 01:28:10 +0000
Subject: RE: [PHP-DB] In_Array in Query
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-42298@lists.php.net to get a copy of this message
not as sucj, but you could consider a sub-select (providiing your version of mysql supports it) something like this might also work $query = "select id from table where somefield [in|=|like] (". in_array(row,'$user_area').")"; Bastien
From: Kevin Murphy <php@stubborndonkey.com> To: php-db@lists.php.net Subject: [PHP-DB] In_Array in Query Date: Tue, 22 Aug 2006 18:13:11 -0700 I'm wondering if something like this is possible, where $array is an array. $query = "select id from table where in_array(row,'$user_area')"; Is it possible to see if the value of a particular row is in an array? I know I could create a loop where it would go through each one, but I was hoping not to do something like the following: $query = "select id from table where row = $user_area[0] OR row = $user_area[1] OR row = $user_area[2]" -- Kevin Murphy Webmaster: Information and Marketing Services Western Nevada Community College www.wncc.edu 775-445-3326


« previous php.db (#42298) next »