I'm getting the message
"MySQLSyntaxErrorExcetpion You have an error in your SQL syntax."
I'm following a tutorial online and I don't see what's anything different with my code and the code I'm following. Can anyone point out where I went wrong?
Let me know if additional information is needed.
btn_update.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
try{
theQuery("update users set fname = '" + firstNameField.getText() + "', lname = '" + lastNameField.getText() +"', age=" + ageField.getText() + "where id = " + idField.getText());
}
catch(Exception ex)
{
System.out.println(ex);
}
}
});

PreparedStatementinstead.