proud Posted July 25, 2007 Share Posted July 25, 2007 I designed a login form and when the user logs in with his username and password I want to make sure that they are identical to the ones in the database (case sensitive), so I tried this code but it did not work; if you login with (jack) or (JACK) both are accepted. $sql = "SELECT user_name FROM users WHERE STRCMP(user_name,'$userid') = 0 UNION SELECT user_pass FROM users WHERE STRCMP(user_pass,'$password') = 0"; $result=mysql_query($sql); $row = mysql_fetch_array( $result ); So is there any idea what is going wrong? Link to comment https://forums.phpfreaks.com/topic/61674-case-sensitive-comparison/ Share on other sites More sharing options...
tibberous Posted July 25, 2007 Share Posted July 25, 2007 $sql = "SELECT user_name, user_pass FROM users WHERE user_name='$userid', user_pass='$password'"; Link to comment https://forums.phpfreaks.com/topic/61674-case-sensitive-comparison/#findComment-306987 Share on other sites More sharing options...
proud Posted July 25, 2007 Author Share Posted July 25, 2007 This query just selects the username and the password but it doesnt check if they are both in the same case. i.e (jack) and (JACK) will both be accepted by this query and that's not what I want. Link to comment https://forums.phpfreaks.com/topic/61674-case-sensitive-comparison/#findComment-306992 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.