I'm getting this error while trying to run this code You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''And StatusMembership=Active' at line 1
public boolean checkLenderToIfExists(BorrowedBook borrowedBook) throws SQLException {
try {
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM library_students.student WHERE StudentID='"+ borrowedBook.getLenderTo()+"'And Permission=1"+"'And StatusMembership='Active'");
if (!(rs.next())) {
return false;
}
rs.close();
return true;
} catch (SQLException ex) {
ex.printStackTrace();
return false;
}