Odp: is LIKE operator case sensitive ???
| From: | Krzysztof Socki | Date: | Tue, 20 Aug 2002 10:22:55 +0000 |
| Subject: | Odp: is LIKE operator case sensitive ??? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-21248@lists.php.net to get a copy of this message | ||
> im using query "SELECT * FROM table WHERE field LIKE '% $variable %' "
>
> with this, i want it should not be case sensitive, and should not
> distinguish betn ram,Ram,RAM. but its not doing so. i don't want the case
> sensitive result.
>
You can do it in this way:
"SELECT * FROM table WHERE LOWER(field) LIKE
'%".strtolower($variable)."%'"
LOWER is an SQL function and strtolower is a PHP function. They are both
doing the same thing: returning string with all alphabetic characters
converted to lowercase.
KS