[SOLVED] case sensitive query

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
Kingo
Forum Contributor
Posts: 146
Joined: Thu Jun 03, 2004 9:38 am

[SOLVED] case sensitive query

Post 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");
Last edited by Kingo on Wed Sep 15, 2004 1:53 pm, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

set the field to binary.
Kingo
Forum Contributor
Posts: 146
Joined: Thu Jun 03, 2004 9:38 am

SOLVED

Post by Kingo »

Thanx . It works.
User avatar
dethron
Forum Contributor
Posts: 370
Joined: Sat Apr 27, 2002 11:39 am
Location: Istanbul

Post 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 ;)
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Always expect the worst when allowing the user to modify your queries..
Post Reply