Why this statement rs=st.executeQuery(query); is not excuting? How can I select only a table depend on input type=radio from mysql from two tables?
Why is this query rs=st.executeQuery(query) ; not executed to select a table from database? String gender = request.getParameter("gender"); if (gender != null) { String table = gender.equals("teacher") ? "teacher2" : "student"; String query ="select username,password from " +table+ " where username='"+name+"' AND password='"+abc+"'"; rs=st.executeQuery(query); //Why This statement having error } Mysql Query for this table enter image description here i think this query is wrong "select username,password from "+table+" where username='"+name+"' AND password='"+abc+"'"; I have two tables one is