What I have is a form which the user enters a code and the script check the db to see if it exists and then directs the user to a page. That part works fine but only if the user enters the code exactly as its stored in the db.
for example if the code is WY09VGM in the db then thats exactly what the user has to enter. If they enter WY09 VGM its not picked up same goes for wy09vgm.
Guys, I don't know if this discussion was because of my wrong solution. And I have to apologize if my solution is directing OP to somewhere wrong way.
But please note what OP has said that he is trying to match a code which I thought for some kind of verifications/confirmation (like sign up confirmation or so) because his example codes seem random codes. For that particular case, I normally do in that way like storing codes all in uppercase and check user entered codes are all in upper case or not in PHP itself. But I don't check against database for case check. I have never stored other user data like names, surnames, etc. in any lower/upper case and neither I suggest anyone to do that. I just store how they enter.