member_delete.jsp
페이지 정보
작성자 관리자 작성일 21-07-15 19:43 조회 422 댓글 0본문
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.sql.*"%>
<%
if ((session.getAttribute("id")==null) || (!((String)session.getAttribute("id")).equals("admin"))) {
out.println("<script>");
out.println("location.href='loginForm.jsp'");
out.println("</script>");
}
Class.forName("com.mysql.jdbc.Driver");
String url="jdbc:mysql://localhost:3306/web";
String user="root";
String password="1111";
Connection conn=null;
PreparedStatement pstmt=null;
ResultSet rs=null;
String info_id = request.getParameter("id");
try {
conn=DriverManager.getConnection(url, user, password);
pstmt=conn.prepareStatement("delete FROM member2 WHERE id=?");
pstmt.setString(1,info_id);
pstmt.executeUpdate();
out.println("<script>");
out.println("alert('삭제 됨')");
out.println("location.href='member_list.jsp'");
out.println("</script>");
}catch(Exception e){
e.printStackTrace();
}finally{
try{
pstmt.close();
conn.close();
}
catch(Exception e){
e.printStackTrace();
}
}
%>
댓글목록 0
등록된 댓글이 없습니다.