title: java.sql.SQLException: Parameter index out of range (5 > number of parameters, which is 4) on Netbeans
body: <p>I started to learn making java GUI applications with Netbeans. I'm following a tutorial on youtube: <a href="https://www.youtube.com/watch?v=j0aEUB2Efuk" rel="nofollow noreferrer">https://www.youtube.com/watch?v=j0aEUB2Efuk</a>. But I'm facing an error with mysql, I did the same as the guy in the video but is not working. Here's the code:</p>
  
  <pre><code>public boolean editClient(int id, String fname, String lname, String phone, String email) {
          PreparedStatement st;
          String editQuery = "UPDATE `clients` SET `first_name` = ?, `last_name = ?`, `phone` = ?, `email` = ? WHERE `id` = ? ";
  
          try {
  
              st = my_connection.createConnection().prepareStatement(editQuery);
  
              st.setInt(1, id);
              st.setString(2, fname);
              st.setString(3, lname);
              st.setString(4, phone);
              st.setString(5, email);
  
  
              return st.executeUpdate() &gt; 0;
  
          } catch (SQLException ex) {
              Logger.getLogger(CLIENT.class.getName()).log(Level.SEVERE, null, ex);
              return false;
          }
      }
  </code></pre>
  
  <p>The sql query seems to be ok or maybe is a bug with JDBC driver.</p>