Page 1 of 1

Not case sensitive

Posted: Tue Aug 20, 2002 11:19 pm
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

Posted: Tue Aug 20, 2002 11:24 pm
by protokol
you could check out strcasecmp()

OR

try this:

if (strtolower($subject) == strtolower($temp_subject)) {
}

Posted: Wed Aug 21, 2002 5:36 am
by mikeq
No it's not case sensitive

Posted: Wed Aug 21, 2002 8:24 am
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....