Hello,
I have a user profile script that I just went live with, and there is a minor bug that I can't figure out a way around very easily, just calling on the help of others as I've searched the web and can't quickly find a solution.
Each account in the mysql database is permanently identified by a unique number that never changes. Each account also has aliases that the account can be identified by, but they can change.
When a user logs in, they can enter either their name or their ID. The first thing I want to do when they submit the form is to determine their unique account ID. I have a mysql select statement with a where claus like the following...
#$string being the input from the form
where ID='$string' A1='$string' A2='$string'
the column ID being type int, and A1 and A2 being char.
This works fine for validating that the account actually exisits and grabbing the ID, until someone has the alias '7hm', or '007_sniper'. Because the numbers are at the begining of the string, the string is converted to the numeric value of '7', so if the User '7hm' in actuality has the ID of '145', it will pull in the ID '7'
I don't have to include the ID in the where claus if I can determine that the user did NOT enter an ID. I'm not sure how to determine if the user entered an ID or an alias. Can someone help me through this, or does anyone see a better way around this?
I'd just like to say thanks for reading, and that I appreciate your help in this. If there is something I didn't explain clearly or if I left something out, just let me know.
-Twenty7
-Twenty7
I have a user profile script that I just went live with, and there is a minor bug that I can't figure out a way around very easily, just calling on the help of others as I've searched the web and can't quickly find a solution.
Each account in the mysql database is permanently identified by a unique number that never changes. Each account also has aliases that the account can be identified by, but they can change.
When a user logs in, they can enter either their name or their ID. The first thing I want to do when they submit the form is to determine their unique account ID. I have a mysql select statement with a where claus like the following...
#$string being the input from the form
where ID='$string' A1='$string' A2='$string'
the column ID being type int, and A1 and A2 being char.
This works fine for validating that the account actually exisits and grabbing the ID, until someone has the alias '7hm', or '007_sniper'. Because the numbers are at the begining of the string, the string is converted to the numeric value of '7', so if the User '7hm' in actuality has the ID of '145', it will pull in the ID '7'
I don't have to include the ID in the where claus if I can determine that the user did NOT enter an ID. I'm not sure how to determine if the user entered an ID or an alias. Can someone help me through this, or does anyone see a better way around this?
I'd just like to say thanks for reading, and that I appreciate your help in this. If there is something I didn't explain clearly or if I left something out, just let me know.
-Twenty7
-Twenty7