Put a % at the beginning of the string "%Classical%", (which will mean that
any index is not used)

-----Original Message-----
From: Tyler Longren [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 8 March 2001 4:26 p.m.
To: MySQL List
Subject: Searching for string in field


Hello,

I've got a field named genres.  It's got a bunch of different music genre's
in it.  I want to let a user enter a genre to search for.  Here's what I'm
using now:

SELECT * FROM $mysql_artist_table WHERE genres like '$search_genre%' ORDER
BY ARTIST ASC

And that only searches at the beginning of the field.

Say a user searches for Classical:
SELECT * FROM $mysql_artist_table WHERE genres like 'Classical%' ORDER BY
ARTIST ASC

And this is the contents of the field:
Rock, Country, Classical, Punk, Rap, Metal, Hardcore

The query would never find 'Classical'.  So, how can I search a field for a
string of text?

Any replies are welcome, thanks,
Tyler Longren


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

The information contained in this email is privileged and confidential
and intended for the addressee only. If you are not the intended 
recipient, you are asked to respect that confidentiality and not 
disclose, copy or make use of its contents. If received in error 
you are asked to destroy this email and contact the sender immediately. 
Your assistance is appreciated.

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to