I have a method that should check the arguments that the user has given. In the database I have columns named email, and password (among others). How can I make the check if the arguments that the user has given are right? Here is what I tried, and I have a very strong feeling that this is very wrong. Can I in some way say: Select email and password from users (The table is called users)
public boolean returnValidCredentials(String emailParsed, String passwordParsed){
try {
rSet = statement.executeQuery("SELECT * FROM users");
String emailRes = rSet.getString("email");
String passwordRes = rSet.getString("password");
while(rSet.next()){
if(!(emailRes.equalsIgnoreCase(passwordParsed) && passwordRes.equals(passwordParsed))){
return false;
}
}
} catch (SQLException e) {
displayMsg("Exception at method returnValidCredentials()");
}
return true;
}
I have a feeling that my code while break/return false after this first check that returns false, and it wont even check the rest. Even though, the true result might be right after it returned false
This post has been edited by AOM_Set: 02 May 2012 - 02:17 PM

New Topic/Question
Reply




MultiQuote




|