title: SQL update statement in Java
body: <p>I am trying to update a field in my table using Netbeans and I have two conditions. The update statement is as follows:</p>
  
  <pre><code>String sql1 = "update tbl_log set Logout_Time =? where Firstname = ? and Check = ?";
          try{
              pst = conn.prepareStatement(sql1);
              pst.setString(1, time);
              pst.setString(2, username);
              pst.setString(3, "IN");
              pst.execute();
          }catch(Exception e){
              JOptionPane.showMessageDialog(null, e);
          }
  </code></pre>
  
  <p>but I am getting the following error:</p>
  
  <p>com.mysql.jdbc.exceptions.jdbc4.MySQL SyntaxErrorException: 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 'Check = 'IN' at line 1</p>
  
  <p>How can I solve it?</p>