Re: Why is this query killing me?
| From: | Michael van Bracht | Date: | Wed, 17 Oct 2001 18:06:16 +0000 |
| Subject: | Re: Why is this query killing me? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-71369@lists.php.net to get a copy of this message | ||
On Wed, 17 Oct 2001 13:55:08 -0400 "Jeff Lewis" <jeff@hyrum.net> wrote:
> When I was leaving a space it was returning results like:
>
> carpets, caring etc when we're only trying t get the words themselves. So
> this wahy w're grabbing the word car with a space on either side :)
>
mysql supports UPPER/LOWER funtions, UPPER/LOWER the sql value and support
the compared value as upper/lower, too.
SELECT pub, class, startdate, adtext FROM classifieds WHERE (UPPER(pub)='KWR' OR
UPPER(pub)='GUE') AND (startdate<'17-Oct-01') AND ( UPPER(adtext) LIKE
'% GERMAN %' OR
UPPER(adtext) LIKE '% CAR %');
> The problem we're having though is with case and multiple search keywords.
>
> Jeff
> ----- Original Message -----
> From: "Alex Shi" <chpshi@netvigator.ca>
> To: "Jeff Lewis" <jeff@hyrum.net>; <php-general@lists.php.net>
> Sent: Wednesday, October 17, 2001 1:52 PM
> Subject: Re: [PHP] Why is this query killing me?
>
>
> > Why you leave a space between the keyword and '%' on each side of it ?
> >
> > Alex
> >
> > ----- Original Message -----
> > From: "Jeff Lewis" <jeff@hyrum.net>
> > To: <php-general@lists.php.net>
> > Sent: Wednesday, October 17, 2001 1:45 PM
> > Subject: [PHP] Why is this query killing me?
> >
> >
> > I am creating an advanced search with PHP and pulling from mySQL and here
> is
> > an example of a query I have built:
> >
> > SELECT pub, class, startdate, adtext FROM classifieds WHERE (pub='KWR' OR
> > pub='GUE') AND (startdate<'17-Oct-01') AND ( adtext LIKE '%
> > German %' OR
> > adtext LIKE '% car %');
> >
> > Now with this, it returns an ad about German sheppard pups but doesn't
> > return any of the dozens of ads about cars. Now if I use german in lower
> > case it won't return the German Sheppard pups ad as well!!
> >
> > What am I doing wrong?
> >
> > Jeff
> >
> >
> >
> > --
> > 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
> >
> >
> >
>
>
> --
> 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
>
>
--
-------------------------------------------------------
intraDAT AG http://www.intradat.com
Wilhelm-Leuschner-Strasse 7 Tel: +49 69-25629-0
D - 60329 Frankfurt am Main Fax: +49 69-25629-256