loop during a mysql query
| From: | dbarber | Date: | Sun, 08 Oct 2000 12:16:25 +0000 |
| Subject: | loop during a mysql query | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-19084@lists.php.net to get a copy of this message | ||
Hello,
I want to run a mysql query where the object I'm searching on is pulled
from an array. The actual query would look something like this:
"select email from position where description like 'linux' and [ next
value in array ] id ='7';"
It would loop on the array values in the middle of the query. Can anyone
tell me how to actually get this code working? Here is what I have been
playing with.
------------------------------------------------------
$selquery = "Select email from position where " .
foreach($set_keywords as $value)
{
$line="description like '%$value%' and ";
$line
}
. "id = '7' ";
--------------------------------------------------
thanks,
Dan