delete record

delete record

how to delete record using checkbox and button in php

View Answers

September 4, 2012 at 6:06 PM

We are providing you the jsp code that displays the database table data into the html table. Along each table row there is a checkbox consists of id of table. When the user selects the particular checkbox, that row will get deleted from the database. In the database we have created three fields bookid,author and title in the database.

1) Create book.jsp

<%@page import="java.sql.*"%>

<form name=myname method=post action="delete.jsp">
<table border="1">
<tr><td></td>
<td><b><u>bookid</u></b></td>
<td><b><u>Author</u></b></td>
<td><b><u>title</u></b></td>
</tr>
<%try{

Connection conn = null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql","root", "root");
ResultSet rs = null;
Statement st=null;
st=conn.createStatement();
rs = st.executeQuery("select * from book");
int i=0; while(rs.next()){ %>
<tr><td><input type="checkbox" name="check<%=i%>" value=<%= rs.getString("bookid") %>></td>
<td><%= rs.getString("bookid") %></td>
<td><%= rs.getString("author") %></td>
<td><%= rs.getString("title") %></td>
</tr><%
i++;
}
}catch(SQLException e){ System.out.println(e.getMessage()); } %>
</table>
<input type="submit">
</form>

2) Create delete.jsp

<%@page import="java.sql.*"%>

<%String id[]= new String[10];
for(int i=0;i<10;i++){
id[i]=request.getParameter("check"+i);
out.println(id[i]);
}
%>

<%try{

Connection conn = null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql","root", "root");
ResultSet rs = null;
Statement st=null;
st=conn.createStatement();
for(int a=0;a<10;a++){
st.executeUpdate("delete from book where bookid='"+id[a]+"'");

}
}catch(SQLException e){ 
    System.out.println(e.getMessage()); 
    }
    %>









Related Tutorials/Questions & Answers:
delete record
delete record  how to delete record using checkbox and button in php   We are providing you the jsp code that displays the database table...=conn.createStatement(); for(int a=0;a<10;a++){ st.executeUpdate("delete from book where
Write a query to delete a record from a table
Write a query to delete a record from a table  Write a query to delete a record from a table   Hi, The query string for the delete operation is as follows-ADS_TO_REPLACE_1 delete from employee where id='35'; Thanks
Advertisements
Hibernate Delete Query
In this section we will discuss how to delete record of table using HQL
hibernate delete orphan
In this section, you will learn to delete mapped record using cascade delete-orphan in Hibernate
JDBC: Delete Record using Prepared Statement
JDBC: Delete Record using Prepared Statement In this section, we will discuss... statement. You can delete any specific record under some condition using WHERE...) { System.out.println("Delete Record using PreparedStatement..."); Connection con = null
JSP Delete Record From Table Using MySQL
JSP Delete Record From Table Using MySQL This tutorial explains you that how.... In this tutorial you will learn that how to delete a record of a database table in JSP. In this example we will discuss about how to delete a record of database table
delete
delete  how delete only one row in the database using jsp.database...;td><input type="button" name="edit" value="Delete" style="background-color..."); Statement st = conn.createStatement(); st.executeUpdate("DELETE FROM employee
DELETE
DELETE   I AM DOING IT IN MYSQL. DELETE FROM EMP WHERE SAL>(SELECT SAL FROM EMP WHERE ENAME='MILLAR') AND ENAME='ALLEN'; THIS IS GIVING THE FOLLOWING ERROR Error Code : 1093 You can't specify target table 'EMP
Delete All Records
Delete All Records       In this section, you will learn how to delete all record using jpa...(); entr.begin(); Query query=em.createQuery("DELETE FROM Student st
JDBC Delete Statement Example
.style1 { text-align: center; } JDBC Delete statement Example A JDBC delete statement deletes the particular record of the table. At first create...(); // creating Query String String query = "DELETE FROM student WHERE RollNo=1
record management application - Java Beginners
record management application  write a small record management application for a school.Tasks will be Add record, Edit record,Delete record, List records. Each record contains: name(max 100 char), Age,Notes(No Max.Limit
delete jsp
;<br/> <input type="submit" value="Delete record"/></center>...delete jsp  <%@ page language="java" contentType="text/html...; charset=ISO-8859-1"> <title>Delete Student</title> </head>
Delete Account
Delete Account  How to delete account
Edit the record.
Edit the record.  sir, I have a table consist of huge data.I have displayed that data.side of them there is an edit button which will edit... to previous edited row or edit the previous record of the previously edited
Delete a Records in Database
is used to delete the record from table country  followed by where clause, which... Delete a Records in Database       The Delete Statement is used to delete the records and rows
ModuleNotFoundError: No module named 'Record'
ModuleNotFoundError: No module named 'Record'  Hi, My Python... 'Record' How to remove the ModuleNotFoundError: No module named 'Record'... to install padas library. You can install Record python with following command
Create Delete Trigger in SQL
Create Delete Trigger in SQL       Create Delete Trigger in SQL fire this trigger before the DELETE operation is executed. Understand with ExampleADS
delete data from database - SQL
delete data from database  HOw to delete specific data from table> I want to delete one record from database. Thnx  Hi friend, -------------------------------------------- Visit for more information
To delete post
To delete post  How can I delete my old post answer. I've posted 2 same answers by mistake
Create Delete Trigger in SQL
Create Delete Trigger in SQL       Create Delete Trigger in SQL fire this trigger before the DELETE operation is executed. Understand with ExampleADS
Use of delete() method in hibernate.
Department and the deptId. Now you can delete record by calling delete method...Use of delete() method in hibernate.  Define the use of delete() method of hibernate?   Hibernate provide the facility to delete one row
next and previous record in php
next and previous record in php  How to display next and previous records in PHP
Jsp code for disabling record.
Jsp code for disabling record.  I want a Jsp and servlet code for the mentioned scenario. Q. A cross sign appears in front of each record, click to disable the record.System marks the record as disabled.The record
how to edit a record in hibernate?
how to edit a record in hibernate?  how to edit a record in hibernate?   Hi Friend, Please visit the following link:ADS_TO_REPLACE_1 Hibernate Tutorials Thanks   Hi Friend,ADS_TO_REPLACE_2 Please visit
Acess Record from database.
Acess Record from database.  How to access records from database and how to display it on view page, with the help of hibernate
How to delete objects using Hibernate?
How to delete objects using Hibernate?  Hi, How to delete objects using Hibernate? I want to delete an object (record) in table. Thanks   Hi, Hibernate Session API provides function to delete object. For deleting
sorting student record - Java Beginners
. Insert Record"); System.out.println("2. Delete Record"); System.out.println...("insert"); //do ur work here } public void delete(){ System.out.println("delete"); //do ur work here } public void display
retrieve record from table
retrieve record from table  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have to retrieve these data from the field table. Actually
add record to database - JDBC
add record to database  How to create program in java that can save record in database ?  Hi friend, import java.io.*; import java.sql....); if(i!=0){ out.println("The record has been inserted
query to fetch the highest record in a table
query to fetch the highest record in a table  Write a query to fetch the highest record in a table, based on a record, say salary field in the empsalary table
Record and Save Video using Java
Record and Save Video using Java  How to record video(webcam) and save it using Java.?? Its really urgent
delete row
delete row  how to delete row using checkbox and button in php...="delete" > <table width="100%" border="1"> <tr><td>...;/table> <input type="submit" name="delete" value="delete" /> <?php
delete() method of hibernate
delete() method of hibernate  Define the use of delete() method of hibernate? Example
delete javascript object
delete javascript object  How to create and delete an object in JavaScript
delete an entry using JavaScript
delete an entry using JavaScript  How to delete an entry using JavaScript
Record management application for a school
of new students, edit the record of students and can delete the record...("Notes:"); l5 = new JLabel("Enter ID to delete Record:"); l7 = new JLabel...("Delete Record", p); f.setSize(450, 180); f.setVisible(true); } public
ModuleNotFoundError: No module named 'code-record'
ModuleNotFoundError: No module named 'code-record'  Hi, My Python... 'code-record' How to remove the ModuleNotFoundError: No module named 'code-record' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'docker-record'
ModuleNotFoundError: No module named 'docker-record'  Hi, My... 'docker-record' How to remove the ModuleNotFoundError: No module named 'docker-record' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'docker-record'
ModuleNotFoundError: No module named 'docker-record'  Hi, My... 'docker-record' How to remove the ModuleNotFoundError: No module named 'docker-record' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'lazy_record'
ModuleNotFoundError: No module named 'lazy_record'  Hi, My Python... 'lazy_record' How to remove the ModuleNotFoundError: No module named 'lazy_record' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'lazy_record'
ModuleNotFoundError: No module named 'lazy_record'  Hi, My Python... 'lazy_record' How to remove the ModuleNotFoundError: No module named 'lazy_record' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'lazy_record'
ModuleNotFoundError: No module named 'lazy_record'  Hi, My Python... 'lazy_record' How to remove the ModuleNotFoundError: No module named 'lazy_record' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'lazy_record'
ModuleNotFoundError: No module named 'lazy_record'  Hi, My Python... 'lazy_record' How to remove the ModuleNotFoundError: No module named 'lazy_record' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'lazy_record'
ModuleNotFoundError: No module named 'lazy_record'  Hi, My Python... 'lazy_record' How to remove the ModuleNotFoundError: No module named 'lazy_record' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'mouse_record'
ModuleNotFoundError: No module named 'mouse_record'  Hi, My Python... 'mouse_record' How to remove the ModuleNotFoundError: No module named 'mouse_record' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'ns_record'
ModuleNotFoundError: No module named 'ns_record'  Hi, My Python..._record' How to remove the ModuleNotFoundError: No module named 'ns_record' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'record-keeper'
ModuleNotFoundError: No module named 'record-keeper'  Hi, My... 'record-keeper' How to remove the ModuleNotFoundError: No module named 'record-keeper' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'record-recommender'
ModuleNotFoundError: No module named 'record-recommender'  Hi, My... named 'record-recommender' How to remove the ModuleNotFoundError: No module named 'record-recommender' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'wsgim-record'
ModuleNotFoundError: No module named 'wsgim-record'  Hi, My Python... 'wsgim-record' How to remove the ModuleNotFoundError: No module named 'wsgim-record' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'code-record'
ModuleNotFoundError: No module named 'code-record'  Hi, My Python... 'code-record' How to remove the ModuleNotFoundError: No module named 'code-record' error? Thanks   Hi, In your python environment

Ads