Home Answers Viewqa PHP delete record

 
 


sourabh parihar
delete record
1 Answer(s)      9 months ago
Posted in : PHP

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 Pages:
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- delete from employee where id='35'; Thanks
delete
delete  how delete only one row in the database using jsp.database... type="button" name="edit" value="Delete" style="background-color:red;font-weight... = conn.createStatement(); st.executeUpdate("DELETE FROM employee WHERE empid
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... { // Delete record String sql = "DELETE FROM student WHERE roll
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>
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
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 All Records
Delete All Records       In this section, you will learn how to delete all record using jpa...(); Query query=em.createQuery("DELETE FROM Student st"); int
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
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
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 Example
Delete a Records in Database
; The delete query is used to delete the record from table country  followed... Delete a Records in Database       The Delete Statement is used to delete the records and rows
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... query = "DELETE FROM student WHERE RollNo=1"; // Updating Table
J2ME Record Store MIDlet Example
and delete the record: RecordStore r_store; r_store = ... J2ME Record Store MIDlet Example       This is a simple program to record data and print
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
Problem in record viewing in jsp - JSP-Servlet
Problem in record viewing in jsp  hai i have developed the application using jsp,servlets in eclipse ide i have to insert,delete,update and view... it is i cannot view the record after eclipse ide is closed and reopen
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 Example
hibernate delete query :
= query.executeUpate(); if(row==0) logger.info("Doesn't delete row. Record...hibernate delete query :   Hi, I m using Hibernate 3 + javadb my... NOT NULL , ITEM_ID INTEGER NOT NULL ) I want to delete a row from table
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
Update after delete
Update after delete  sir,i am working on online examination project in servlet.I am facing some problem that are -i have assign id column 1,2,3..... and i am deleting 3 record using id column of database mysql so now id
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
PHP MySQL Delete
than one record at a time. General format of the delete command is given... PHP MySQL Delete:       In SQL, sometimes we need to delete unwanted records from the table. SQL provides delete
MySQL PHP Query delete
MySQL PHP Query delete       Mysql PHP Query delete is used to execute Mysql function ( ) delete query from a database table. MySQL PHP Query is used to delete the records
Hibernate delete Query
will delete the field's record. To do so at first I have created a table...Hibernate delete Query In this tutorial you will learn how to use HQL delete query in Hibernate. In this section we are discussing about the HQL delete query
MySQL PHP Query delete
MySQL PHP Query delete       Mysql PHP Query delete is used to execute Mysql function ( ) delete query from a database table. MySQL PHP Query is used to delete the records
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
Mysql Trigger After Delete
to delete record from employee table:- We run a delete query  in table employee... Mysql Trigger After Delete     ... perform Delete Operation on Table. Understand with Example The Tutorial illustrate
JDBC Delete Row In Table Example
JDBC Delete Row In Table Example : In this tutorial we will learn how delete... or more specific  row delete from table that follow any given condition. If any datrabase or table not exist first create and enter record
J2ME Record Data Base
() and delete the data through deleteRecord() method. In this example all record... J2ME Record Data Base      ... the getRecord() method, write the data through setRecord() method, open the record
Delete Account
Delete Account  How to delete account
Add Edit And Delete Employee Information
Add Edit and Delete Employee Information Using Swing  ..., edit and delete the Employee's information from the database using java swing... updated. In the third tab, we have allowed the user to delete the particular employee
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
Update Record using Prepared Statement
JDBC: Update Record using Prepared Statement In this section, you... statement. Update record is most important operation of database. You can update one...): This method executes SQL statements(insert, update or delete)in PreparedStatement
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: Hibernate Tutorials Thanks   Hi Friend, Please visit the following link: Hibernate
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 use confirmation alert box before delete in jsp?
to delete the record?'); if(doIt){ var f=document.form; f.method="post...how to use confirmation alert box before delete in jsp?  I use submit..." name="delete" value="Delete" style="background-color:red;font-weight:bold;color
include a delete option in every row of table in a JSP page
on Delete it should delete the particular record from the database and reflect...include a delete option in every row of table in a JSP page  I have the following code of a JSP page........... <blockquote> <p>
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
To delete post
To delete post  How can I delete my old post answer. I've posted 2 same answers by mistake
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
How to insert or delete records in MS access database using jsp - JSP-Servlet
How to insert or delete records in MS access database using jsp  Hi friends please provide me a solution that i insert or delete record from a database using java server pages. I used the microsoft access 2003 database. PlZ
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
Mysql Last Record
Mysql Last Record       Mysql Last Record is used to the return the record using order... in set (0.00 sec) Query to view last record of  Table named
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
JDBC: Insert Record using Prepared Statements
JDBC: Insert Record using Prepared Statements In this section, you will learn...(insert, update or delete)in PreparedStatement object, which takes the SQL... student record using PreparedStatement. package jdbc; import
Write a query to insert a record into a table
Write a query to insert a record into a table  Write a query to insert a record into a table   Hi, The query string is as follows- Insert into employee values ('35','gyan','singh'); Thanks