RE: [PHP] confused about logic
| From: | Aaron Wolski | Date: | Fri, 19 Mar 2004 17:03:29 +0000 |
| Subject: | RE: [PHP] confused about logic | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-180981@lists.php.net to get a copy of this message | ||
Thanks for the time John.
Chris's did the trick. I'll keep yours on hand in case I do happen to
run into problems.
I DO appreciate your help.
Thanks again!
Aaron
> -----Original Message-----
> From: John W. Holmes [mailto:holmes072000@charter.net]
> Sent: March 19, 2004 11:28 AM
> To: Aaron Wolski; php-general@lists.php.net
> Subject: Re: [PHP] confused about logic
>
> From: "Aaron Wolski" <aaronjw@martekbiz.com>
>
> > I have input for where users can enter order numbers in which to
search
> > the database to find results matching their entry.
> >
> > To enter multiple order numbers they can comma separate like:
> > 1,34,21,34,54
> >
> > What I need to do is take those numbers and make a query that would
like
> > like:
> >
> > (cart_id in('1','34','21','34','54') OR
> > id
in('1','34','21','34','54'))
>
> Why do you need to put quotes around integers??
>
> $var = '1,34,21,34,54';
>
> //replace comma with quote,comma,quote and add quotes to beginning and
end
> $in_clause = "'" . str_replace(',',"','",$var) .
> "'";
>
> $query = "WHERE (cart_id IN ($in_clause) OR id IN ($in_clause))";
>
> ---John Holmes...
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>