title: Delete a row from DB
body: <p>i have a simple web application in which you can book a room. Now when someone books a room i want give the possibility to delete the reservation. 
  I have created a jsp file: </p>
  
  <blockquote>
    <p>cancel.jsp </p>
  </blockquote>
  
  <p>with this code:</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt;
  &lt;%@page import="java.sql.*,java.util.*"%&gt;
  &lt;%
  String id=request.getParameter("cid");
  try
  {
  Class.forName("com.mysql.jdbc.Driver");
  Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/HotelReservation", "root", "123456789");
  Statement st=conn.createStatement();
  int i=st.executeUpdate("DELETE FROM hotel_booking WHERE cid="+id);
  out.println("Data Deleted Successfully!");
  }
  catch(Exception e)
  {
  System.out.print(e);
  e.printStackTrace();
  }
  %&gt;
  </code></pre>
  
  <p>and in booked.jsp :</p>
  
  <pre><code>&lt;%  while(rs.next())
          {
  
             int id = rs.getInt("cid");
  
            //  out.println(id);
              String cname  = rs.getString("cname");
             // out.println(cname);
              String email  = rs.getString("email");
              String arrival  = rs.getString("arrival_date");
              String departure  = rs.getString("departure_date");
              int person  = rs.getInt("person");
              int room  = rs.getInt("room");
              String type_room = rs.getString("type_room");
  
  
  
              %&gt; 
  
              &lt;div class="hotel-block"  style="background-color: #5882FA;padding: 2px 15px 30px;margin-top: -20px; width: 102%; margin-left: -23px;"&gt;
                  ...........................................................................................................................................................................................................................................................................................
                  &lt;h2 class="heading"&gt;&lt;label style=" margin-left: 150px; margin-top: 151px;"&gt;Name :&lt;/label&gt;&lt;span  style=" margin-left: 200px;"&gt;&lt;%out.println(cname);%&gt;&lt;/h2&gt; 
                  &lt;h2 class="heading"&gt;&lt;label style="margin-left: 150px;"&gt;Email :&lt;/label&gt;&lt;span  style=" margin-left: 200px;"&gt;&lt;%out.println(email);%&gt;&lt;/span&gt;&lt;/h3&gt; 
                  &lt;h2 class="heading"&gt;&lt;label style="margin-left: 150px;"&gt;arrival date :&lt;/label&gt;&lt;span  style=" margin-left: 100px;"&gt;&lt;%out.println(arrival);%&gt;&lt;/h2&gt;
                  &lt;h2 class="heading"&gt;&lt;label style="margin-left: 150px;"&gt;departure date:&lt;/label&gt;&lt;span  style=" margin-left: 50px;"&gt;&lt;%out.println(departure);%&gt;&lt;/h2&gt; 
                  &lt;h2 class="heading"&gt;&lt;label style="margin-left: 150px;"&gt;no. of person :&lt;/label&gt;&lt;span  style=" margin-left: 70px;"&gt;&lt;%out.println(person);%&gt;&lt;/h2&gt;
                  &lt;h2 class="heading"&gt;&lt;label style="margin-left: 150px;"&gt;no. of room :&lt;/label&gt;&lt;span  style=" margin-left: 100px;"&gt;&lt;%out.println(room);%&gt;&lt;/h2&gt; 
                  &lt;h2 class="heading"&gt;&lt;label style="margin-left: 150px;"&gt;type room:&lt;/label&gt;&lt;span  style=" margin-left: 100px;"&gt;&lt;%out.println(type_room);%&gt;&lt;/h2&gt;
  
                 &lt;form action='cancel.jsp'&gt;
                 &lt;input type="hidden" name="cid" value="&lt;%=("id") %&gt;"&gt;
               &lt;input type='submit' name='cancel' value='Cancel Reservation'&gt;
  
              &lt;/form&gt;
             &lt;/div&gt;
  </code></pre>
  
  <p>Also i have the table in my DB: hotel_booking with this parameters:</p>
  
  <blockquote>
    <p>cid(INT,Primary key,not null, autoincrement); cname; email; arrival_date; departure_date;....</p>
  </blockquote>
  
  <p>I don't understand how can i do to delete a particular reservation. Every times that someone books a room automatically cid increment by one. 
  Can you help me to solve this problem? Thanks</p>