Not case sensitive

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ace2600
Forum Commoner
Posts: 30
Joined: Fri Jun 21, 2002 12:12 am

Not case sensitive

Post by ace2600 »

When a user fills out a form I want to see if what the user typed is the same as whats in my db. However, I don't want it to be case sensitive. If I use = when comparing, ex: if($subject==$temp_subject), will it be case sensitive? If yes how do I have the two variables compare and not matter on case.
I appreciate the help,
Ace
User avatar
protokol
Forum Contributor
Posts: 353
Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:

Post by protokol »

you could check out strcasecmp()

OR

try this:

if (strtolower($subject) == strtolower($temp_subject)) {
}
User avatar
mikeq
Forum Regular
Posts: 512
Joined: Fri May 03, 2002 3:33 am
Location: Edinburgh, Scotland

Post by mikeq »

No it's not case sensitive
User avatar
enygma
Site Admin
Posts: 175
Joined: Fri Apr 19, 2002 8:29 am
Location: Dallas, Tx

Post by enygma »

or you could always do it on the SQL level:

Code: Select all

$sql="select foo from bar where upper(test)='".strtoupper($input)."'";
i think upper() is Oracle-specific, but you get the idea....
Post Reply