java - JDBC returning a result set -
i have database few columns login screen, trying compare entered email persons password in database.
i have following code, although keep getting error saying column email not exist, although in database. ideas?
public string getplayerpassword(string emailparameter) throws sqlexception { loadsqldriver(); string playersemail = null; prestmt = con.preparestatement("select playerpassword players email = ?"); prestmt.setstring(1, emailparameter); rs = prestmt.executequery(); if(rs.next()){ playersemail = rs.getstring("email"); } return playersemail; }
this may because dint select email in query
prestmt = con.preparestatement("select playerpassword players email = ?");
and fetching it
playersemail = rs.getstring("email");