Page 1 of 1

[SOLVED] case sensitive query

Posted: Wed Sep 15, 2004 1:39 pm
by Kingo
Hello,
I'm running a query for user name and password. But, it works for both the CASES{ Lower case & Upper Case}. How do i check for CASE too.
Any help is really appreciated.
Here is the query.

Code: Select all

$username = $_POST["name"];
$password = $_POST["pass"];

$result = MYSQL_QUERY("SELECT * from data WHERE UserName='$username' and PassWord='$password' ")
   or die ("Name and password not found or not matched");

Posted: Wed Sep 15, 2004 1:46 pm
by feyd
set the field to binary.

SOLVED

Posted: Wed Sep 15, 2004 1:51 pm
by Kingo
Thanx . It works.

Posted: Wed Sep 15, 2004 6:51 pm
by dethron
By the way, never thrust users' inputs.
It is good to not pass datas to db directly. I prefer to do some chekings on them.
Remember, there is something like SQL-injection ;)

Posted: Wed Sep 15, 2004 8:53 pm
by John Cartwright
Always expect the worst when allowing the user to modify your queries..