whiteboikyle Posted June 18, 2008 Share Posted June 18, 2008 Okay so if someone registeres there name in my register script as KyLe and the try logging in they can login as KyLe KYLE kyle etc... so i am trying to make it so they HAVE to enter KyLe so how would you go about doing this? Link to comment https://forums.phpfreaks.com/topic/110672-solved-username-case-sensitive/ Share on other sites More sharing options...
DarkWater Posted June 18, 2008 Share Posted June 18, 2008 Use === instead of == when comparing the strings. Link to comment https://forums.phpfreaks.com/topic/110672-solved-username-case-sensitive/#findComment-567767 Share on other sites More sharing options...
bluejay002 Posted June 18, 2008 Share Posted June 18, 2008 if you want to do this in PHP, case sensitive comparison can be done using strcmp(), just like in C. if you want to do this in MySQL, then you need to convert the other field as binary to make it case sensitive, example: SELECT 'aB' LIKE BINARY 'aB'; -- returns 1 which is true SELECT 'aB' LIKE BINARY 'ab'; -- returns 0 which is false is that what you mean? Link to comment https://forums.phpfreaks.com/topic/110672-solved-username-case-sensitive/#findComment-567768 Share on other sites More sharing options...
whiteboikyle Posted June 18, 2008 Author Share Posted June 18, 2008 Yeah i do it through mysql so i will check that! Thanks bluejay! Link to comment https://forums.phpfreaks.com/topic/110672-solved-username-case-sensitive/#findComment-567779 Share on other sites More sharing options...
whiteboikyle Posted June 18, 2008 Author Share Posted June 18, 2008 wait wait it seems to not work correctly.. unless its bad syntax "SELECT * FROM members WHERE username='".$myusername."' and password='".$encrypt_password."'" So where would i input LIKE BINARY at? Link to comment https://forums.phpfreaks.com/topic/110672-solved-username-case-sensitive/#findComment-567802 Share on other sites More sharing options...
Sesquipedalian Posted June 18, 2008 Share Posted June 18, 2008 "SELECT * FROM members WHERE BINARY username='".$myusername."' and BINARY password='".$encrypt_password."'" You just use BINARY. It is put before each value="othervalue" (as shown above). Link to comment https://forums.phpfreaks.com/topic/110672-solved-username-case-sensitive/#findComment-567822 Share on other sites More sharing options...
teng84 Posted June 18, 2008 Share Posted June 18, 2008 mysql is case insensitive so you have to get the data from the db first then compare it with the actual string using php Link to comment https://forums.phpfreaks.com/topic/110672-solved-username-case-sensitive/#findComment-567826 Share on other sites More sharing options...
whiteboikyle Posted June 18, 2008 Author Share Posted June 18, 2008 I also learned that if you set your Collation to latin1_bin it will check it Case Sensitively. teng84: that is not true xD it inputs it case sensitive so when you are comparing the data yes.. But, it wont check the 2 data's using mysql case sensitive unless you have your collation to that.. Thanks DarkWater again for all your help!!! Link to comment https://forums.phpfreaks.com/topic/110672-solved-username-case-sensitive/#findComment-567859 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.