Re: Case sensitive

From: Date: Wed, 24 Aug 2005 18:49:43 +0000
Subject: Re: Case sensitive
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-40134@lists.php.net to get a copy of this message
better to use the sql UPPER/LOWER and keep your variable values the same
Except that they should be escaping the variable to make it db-safe so that will change it ... so if you're going to do that, might as well do this: $safe_stringinput = xxxx_escape_string(strtoupper($stringinput);
One trick is to force the case in your comparison: $ucstringinput = strtoupper($stringinput); $qry = "select * from sometable where upper(address) like '%$ucstringinput%'" Didn't think LIKE was case sensitive, but regardless... forcing upper or lowercase in your comparison doesn't affect output but will make your case sensitivity issue moot. HTH -TG = = = Original message = = = Hi there everyone, I have a little problem, I have a search where people can search the address of a property BUT the search is case sensitive, I don~t WANT it to be. I~m using MySQL and PHP and I generally use something like WHERE address LIKE ~%$stringinput%~ which works with the numbers ONLY, but when I add the address if I don~t put a capital infront of each part of the address it won~t show up. Any ideas how I can make it case INSENSITIVE? (Think that~s the correct phrase). Any help would really be appreciated. Thanks everyone Regards Chris Payne -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.10.15/80 - Release Date: 8/23/2005 ___________________________________________________________ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.db (#40134) next »