STUDENT REGISTRATION WEB APPLICATION USING JAVA(NETBEANS) + MYSQL(PHPMYADMIN) - PART 02
UPDATE AND DELETE STUDENT update.jsp <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@page import="java.sql.*" %> <% if (request.getParameter("submit") != null) { String id = request.getParameter("id"); String name = request.getParameter("sname"); String course = request.getParameter("course"); String fee = request.getParameter("fee"); Connection con; PreparedStatement pst; ResultSet rs; Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost/student", "root", ""); pst = con.prepareStatement("update student_db set stname = ?,course =?,fee= ? where id = ?"); pst.setString(1, name); pst.setString(2, course); pst.setString(3, fee); pst.setString(4, id); pst.executeUpdate();