Question: Hello I am trying to insert into a database and I am getting the error:

```
 SQL Exception: java.sql.SQLException: Parameter index out of range (6 > number of parameters, which is 5).

```

The code causing this is:

```
 PreparedStatement st = connection.prepareStatement("INSERT INTO Members VALUES  ('?','?','?','?','?','?','?','?','?','?','?','?','?','?'','?','?','?','?','?'");
        st.setString(1, username);
        st.setString(2, id);
        st.setString(3, firstName);
        st.setString(4, lastName);
        st.setString(5, address);
        st.setString(6, phone);
        st.setString(7, email);
        st.setInt(8, age);
        st.setString(9, String.valueOf(sex));
        st.setDouble(10, height);
        st.setInt(11, kgs);
        st.setDouble(12, stone);
        st.setInt(13, targetWeightKgs);
        st.setDouble(14, bmi);
        st.setString(15, medicalHistory);
        st.setString(16, extraHistory);
        st.setBoolean(17, smoker);
        st.setBoolean(18, usernameCompleted);
        st.setString(19, myNotes);
        st.executeUpdate();

```

Answer: 
You should not quote your `?` placeholders, even if they represent string data. Quoted question marks will be intrepreted as literal `'?'` strings. It's probably interpreted as 5 parameters because your 6th to last parameter has two `'` characters, so your last 5 `?`s are interpreted as outside of single-quotes.

Try

```
connection.prepareStatement("INSERT INTO Members VALUES
   (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");

```

**UPDATE**

There was a closing ")" missing in the insert statement, that I have now added.
You do not need the `'` surrounding the `?`'s.

```
PreparedStatement st = connection.prepareStatement("INSERT INTO Members VALUES  (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?");

```

`BUT` the real problem here is you double single quoted one of the `?` to look like :`'?'',`