Re: loop during a mysql query
| From: | dbarber | Date: | Sun, 08 Oct 2000 13:19:20 +0000 |
| Subject: | Re: loop during a mysql query | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-19086@lists.php.net to get a copy of this message | ||
Niklas,
Thanks very much, you gave me what I was looking for!
Dan
On Sun, 8 Oct 2000, Niklas Alberth wrote:
> Hi,
>
> $sqlString = "SELECT * FROM table WHERE describtion like 'linux'"
> for($i = 0; $i < count($array); $i++)
> $sqlString .= " AND describtion like ".$array[$i];
>
> echo $sqlString;
>
> That ought to do it.
>
> --Niklas
>
> ----- Original Message -----
> From: "dbarber" <dbarber@sailnet.com>
> To: <php-general@lists.php.net>
> Sent: Sunday, October 08, 2000 2:16 PM
> Subject: [PHP] loop during a mysql query
>
>
> > 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
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>