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? Quote Link to comment 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'"; Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.