clear.jsp
上传用户:szlmxq
上传日期:2014-01-31
资源大小:740k
文件大小:2k
源码类别:

Applet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=GBK" language="java" import="java.sql.*" errorPage="" %>
  2. <jsp:useBean id="mdb" class="ckstudio.db.faq" scope="page"/>
  3. <%!
  4.  int Cint(String cint)
  5.    {
  6.     try {
  7.   int n;
  8.       n= Integer.parseInt(cint);
  9.   return n;
  10.         }
  11.        catch (NumberFormatException e) {
  12.                  return 0;
  13.         }
  14. }
  15. %>
  16. <%
  17. if(session.getAttribute("user_name")==null){
  18.     out.print("你尚未登录或不是本站会员<br>请登录后再来订购本站货物!");
  19. }else{
  20.  String user_name=(String)session.getValue("user_name");
  21.      if(request.getParameter("basket_id")==null){
  22.    
  23.            String sql="select * from basket where user_name='"+user_name+"' and basket_check=false";
  24.            ResultSet rs=mdb.executeQuery(sql);
  25.            if(!rs.next()){
  26.                 ;
  27.    }
  28.            else{
  29.    
  30.          rs.previous();
  31.                  while(rs.next()){
  32.          String sql1="delete from basket where user_name='"+user_name+"' and basket_check=false";
  33.          mdb.executeDelete(sql1);
  34.  }
  35.    }
  36.    
  37.    }else{
  38.        int basket_id=Cint(request.getParameter("basket_id"));
  39.            String sql2="select * from basket where basket_id="+basket_id+"";
  40.        ResultSet rs1=mdb.executeQuery(sql2);
  41.            if(!rs1.next()){
  42.                ;
  43.    }else{
  44.                       rs1.previous();
  45.                       while(rs1.next()){
  46.               String sql1="delete from basket where basket_id="+basket_id+"";
  47.               mdb.executeDelete(sql1);
  48.               }                      
  49.                 }
  50. }
  51. response.sendRedirect("buy.jsp");
  52. mdb.Close();
  53. }
  54. %>