hansman Posted July 16, 2008 Share Posted July 16, 2008 Hello i have a login form with username and password fields. The login will work if i do this $sql="SELECT * FROM AK WHERE name='$myusername' and pass='$mypassword'"; however, i need to select the entire database(states) so i did this.. $table = "AK, AL, AR, AZ, CA, CO, CT, DE, FL, GA, HI, IA, ID, IL, IN, KS, KY, LA, MA, MD, ME, MI, MN, MO, MS, MT, NC, ND, NE, NH, NJ, NM, NV, NY, OH, OK, OR, PA, RI, SC, SD, TN, TX, UT, VA, VT, WA, WI, WV, WY"; $sql="SELECT * FROM $table WHERE name='$myusername' and pass='$mypassword'"; The form will not work with that above. any ideas? Link to comment https://forums.phpfreaks.com/topic/115054-select-an-entire-database/ Share on other sites More sharing options...
rhodesa Posted July 16, 2008 Share Posted July 16, 2008 you have a separate table of users/passwords for each state? Link to comment https://forums.phpfreaks.com/topic/115054-select-an-entire-database/#findComment-591659 Share on other sites More sharing options...
hansman Posted July 16, 2008 Author Share Posted July 16, 2008 yes in each state there is a username and password field Link to comment https://forums.phpfreaks.com/topic/115054-select-an-entire-database/#findComment-591665 Share on other sites More sharing options...
mattclements Posted July 16, 2008 Share Posted July 16, 2008 Can you not simply change all those tables to: UserID UserPassword etc etc State and move all records into this new table! The way it is currently done doesn't really cover "Normalised Data!" Let me know what you think, Matt Link to comment https://forums.phpfreaks.com/topic/115054-select-an-entire-database/#findComment-591669 Share on other sites More sharing options...
hansman Posted July 16, 2008 Author Share Posted July 16, 2008 thinking into it, that is what i need, thanks a lot. Im new to php/ mysql so im reading tutorials and stuff and really havent seen any good ones on how to create a mysql database efficiently. Link to comment https://forums.phpfreaks.com/topic/115054-select-an-entire-database/#findComment-591673 Share on other sites More sharing options...
anon_login_001 Posted July 16, 2008 Share Posted July 16, 2008 Rather or not it's Normalized, you are showing the potential to run into serious problems in the future. If there is a single login point that checks a username and password against ALL states ... is there ever going to be the possibility that a person in Tennessee will have the same login name as a person in Florida? If so, how do you know which person is trying to login? And if there password is valid? Link to comment https://forums.phpfreaks.com/topic/115054-select-an-entire-database/#findComment-591681 Share on other sites More sharing options...
anon_login_001 Posted July 16, 2008 Share Posted July 16, 2008 Sorry, my post came after your epiphany. Ignore me. = ) Link to comment https://forums.phpfreaks.com/topic/115054-select-an-entire-database/#findComment-591684 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.