hello all,
can someone tell me what is wrong with the following log in
jsp script. the count integer is equal to zero where it should be equal to 1 as the username and password are correct.
<%
String username = request.getParameter( "username" );
String password = request.getParameter("password");
session.setAttribute( "theName", username );
session.setAttribute( "thepass", password);
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
String url= "jdbc:mysql://localhost:3306/users";
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection(url,"root","abdfr");
stmt = con.createStatement();
rs= stmt.executeQuery("SELECT * FROM user WHERE username='username' AND password='password'");
rs.last();
int count = rs.getRow();
if (count > 0){
String redirectURL = "hellojsp.jsp";
response.sendRedirect(redirectURL);
}
your help is much appreciated.