title: ERROR : Parameter index out of range (2 > number of parameters, which is 1)
body: <p>i searched here to find solution for my error but no one match my problem , So is there anyone help me to find the error in my code !?</p>
  
  <pre><code> textField_1.addActionListener(new ActionListener() {
                              public void actionPerformed(ActionEvent e) {
  
              try{
              Object selected = list_1.getSelectedValue();
                  Connection conn = null;
                  conn=DriverManager.getConnection("jdbc:mysql://localhost/flyer","root","000");
                  Statement st= conn.createStatement();
  
                  String query = "INSERT INTO flyer_item (discount) SELECT price*? FROM `item` where item_name='?' ";
  
                  // PreparedStatement ps = null;
  
                  int i = Integer.valueOf((textField_1.getText()));
                  i=i/100;
                  java.sql.PreparedStatement ps = conn.prepareStatement(query);
                  ps.setInt(1,i);
                  ps.setString(2, selected.toString());
                  ps.executeUpdate();
                  st.executeUpdate(query);
  
  
  
              } catch (SQLException se){
                  System.out.println(se.getMessage());
  
              }
  
                              } } );
  </code></pre>
  
  <p>Note : mysql statement it's running successfully in workbench .
  thank you </p>