title: How to delete row in database in MySQL using JSP?
body: <p>This is my function. It gets two parameter id of the product and a name. the function delete with MySQL command a row in a database. I know the that there are missing lines in my code, I'm stuck and I don't know how to finish it. I also know that my SQL line is not correct. I'm not sure if combined the String "name" right.</p>
  
  <pre class="lang-java prettyprint-override"><code>public static deletePro(int cat, String name) {
  
      DB db = new DB();
      String sql = "delete from products where pname=+'name' and catid=" + cat;
      ResultSet rs = db.getResultSet(sql);
  
      try {
          while (rs.next()) {
              Products prod = new Products();
              prod.setNamePro(rs.getString(name));
              prod.setAmount(rs.getInt(cat));
          }
  
          rs.close();
          db.closeCon();
      } catch (SQLException e) {
          e.printStackTrace();
      }
  
      return
  }
  </code></pre>