Re: SQL Case sensitivity
| From: | Evan Nemerson | Date: | Wed, 23 Jun 2004 23:45:23 +0000 |
| Subject: | Re: SQL Case sensitivity | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-188932@lists.php.net to get a copy of this message | ||
http://dev.mysql.com/doc/mysql/en/Fulltext_Search.html
should do the trick,
provided you're using MySQL.
On Wednesday 23 Jun 2004 20:14, Gabe wrote:
> I hope I don't get too chastised for a double post ( posted in .db first
> ), but I'm hoping someone can help me.
>
> I'm using PHP with ADOdb ( and an MS Access 2000 db ) to write a simple
> SQL statement but was running into some case sensitivity issues. Here's
> my SQL currently:
>
> SELECT autoQuesID,fldQuesTitle,fldBody
> FROM tblFAQ_Question
> WHERE fldBody LIKE '%$strSearchFor%';
>
> All I'm trying to do is have the users search string searched for in the
> "fldBody" field. However, I'm having problems trying to get it so that
> the search is case-insensitive. For instance:
>
> If I search on "Airline", I get 1 record.
> If I search on "airline", I get 0 records.
>
> I make the value of $strSearchFor lower case ( using strtolower() ), but
> I don't know how to get it so that the contents of the "fldBody" field
> is lower case also. I can't seem to find any functions or operators
> that remove the case-sensitivity. However, I have tried this where
> clause to no avail:
>
> WHERE LCase(fldBody) LIKE '%$strSearchFor%'
>
> Any help would be much appreciated!
--
Evan Nemerson
evan@coeus-group.com
http://coeusgroup.com/en
--
"The greatest mistake is to imagine that the human being is an autonomous
individual. The secret freedom which you can supposedly enjoy under a
despotic government is nonsense, because your thoughts are never entirely
your own. Philosophers, writers, artists, even scientists, not only need
encouragement and an audience, they need constant stimulation from other
people. It is almost impossible to think without talking. If Defoe had really
lived on a desert island, he could not have written Robinson Crusoe, nor
would he have wanted to. Take away freedom of speech, and the creative
faculties dry up."
-George Orwell