i'm try to made a simple log in sistem with java and mysql, the configuration of the db is made up, but i have an error in the SQL sintax:
System.out.println("SISTEM LOGIN");
System.out.println("INSERIRE NOMEUTENTE");
Scanner scan= new Scanner(System.in);
String user= scan.nextLine();
System.out.println("INSERIRE PASSWORD");
String pass= scan.nextLine();
try {
boolean log = true;
while(log) {
//conn db
Connection c = DriverManager.getConnection(url,usr,pswd);
//creaz statement
Statement ss = c.createStatement();
//creaz codice sql
String sql = " SELECT * FROM users WHERE user'" + user + "' && password='" + pass+ "' ";
ResultSet res = ss.executeQuery(sql);
if(res!=null) {
System.out.println("LOGIN");
log = false;
}
else System.out.println("LOGIN FAILE");
}
}
what do you think i haven't see in the sql string? this is the response :
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 ''ciao' && password='12'' at line 1