member_delete.jsp
페이지 정보
본문
<%@ 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();
}
}
%>
- 이전글member_info.jsp 21.07.15
- 다음글● ResultSet 21.07.15
댓글목록
등록된 댓글이 없습니다.