title: Insertion Query Not Working
body: <p>I have a problem in which I think the INSERT statement is wrong as I keep getting the "SQL ERROR". Every time I do the UPDATE statement, it works just fine. I can't seem to find what's wrong with the query.</p>
  
  <p>My database table: <strong>emenu_user</strong> HAS variables <em>id,username,password,email,contact and food</em>. ALL in which are <strong>VARCHAR</strong> (for now).</p>
  
  <pre><code> public void Connection(){
  
          try{
          Connection connection=DriverManager.getConnection("jdbc:mysql://localhost:3306/emenu?zeroDateTimeBehavior=convertToNull","root","");
          if(connection!=null){
          System.out.println("Database connected");
          }else {System.out.println("Database NOT connected");}
  
  
          String name=username_field.getText();
          String pass=password_field.getText();
          String email=email_field.getText();
          String contact=contact_field.getText();
  
          String query="INSERT INTO emenu_user (username,password,email,contact) VALUES (?,?,?,?)";
          PreparedStatement statement = connection.prepareStatement(query);
          statement.setString(1,name);
          statement.setString(2,pass);
          statement.setString(3,email);
          statement.setString(4,contact);
  
  
          int set=statement.executeUpdate();
  
          if(set&gt;0)
          {
              JOptionPane.showMessageDialog(null,"Data Saved");
              homepageMenu homepageMenu= new homepageMenu();
              homepageMenu.setVisible(true);
              dispose();
          }
          else
          {
              JOptionPane.showMessageDialog(null,"ERROR");
          }
  
  
      } catch(SQLException e){
              JOptionPane.showMessageDialog(null,"SQL FAILED");
      }
  
  }
  </code></pre>