can anyone let me know why the part of if statement is not working? but else work perfectly? it should be ( if there is nothing inside administrator table which is (username=varchar,, password= varchar) then let the administrator register himself.
if (click == buttonAdmin) {
Connection con =myConnection.getConnection();
PreparedStatement ps;
ResultSet rs;
try {
ps=con.prepareStatement("SELECT * FROM `adminstrator` ");
rs=ps.executeQuery();
while (rs.next()) {
String username = rs.getString(1);
String password = rs.getString(2);
if ( password.equals("") && username.equals("")) {
new AdminNewRegister();
}
else {
new AdminLogin();
System.out.println("else");
}
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}