// Checkout
  public String checkOut(String memno) {
    String res = " ";
    int count = 0;

    try {

      String query = "Select * from customerdetails WHERE membershipno=?";
      ps = con.prepareStatement(query);
      ps.setString(1, memno);
      rs = ps.executeQuery();
      while (rs.next()) {
        count++;
        System.out.println(count);
      }
      CustomerDBConnection c = new CustomerDBConnection();
      // checking if the max allowed count has already been reached in the customerdetails DB
      System.out.println("calculating the movies checkedout....");
      String result2 = c.checkedOutMovies(memno, count);
      // if it hasnt
      if (result2.equals("true")) {
        System.out.println("checking count in cart...");
        // get the count of movies in the cart
        int count_cart = c.checkCart(memno);
        System.out.println(count_cart);
        // compare with the max_allowed
        System.out.println("checking validity for checkout....");
        res = c.checkValidity(memno, count, count_cart);
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      try {
        rs.close();
        ps.close();
        // con.close();
      } catch (SQLException e) {
        e.printStackTrace();
      }
    }
    return res;
  }
  public String addtoCart(String memNo, int movieId) {
    String res = " ";
    ResultSet rs = null;
    PreparedStatement ps = null;

    try {
      // con = getConnection();
      CustomerDBConnection c = new CustomerDBConnection();
      String result = c.checkCart(memNo, movieId);
      if (result.equals("true")) {
        String result2 = c.decreaseQuantity(movieId);
        if (result2.equals("true")) {
          String query = "Insert into cart(memNo,movieID) values(?,?)";
          ps = con.prepareStatement(query);
          ps.setString(1, memNo);
          System.out.println(memNo);
          ps.setInt(2, movieId);
          System.out.println(movieId);
          ps.executeUpdate();

          String query1 =
              "Select c.movieID,moviename,banner,description,releasedate,rent,category,quantity FROM movie m,cart c WHERE m.IdMovie = c.movieID and c.memNo=?";
          ps = con.prepareStatement(query1);
          ps.setString(1, memNo);
          rs = ps.executeQuery();
          while (rs.next()) {
            int movieID = rs.getInt(1);
            String name = rs.getString(2);
            String banner = rs.getString(3);
            String description = rs.getString(4);
            String releaseDate = rs.getString(5);
            String rent = rs.getString(6);
            String cat = rs.getString(7);
            String quant = rs.getString(8);
            res +=
                movieID
                    + ";"
                    + name
                    + ";"
                    + banner
                    + ";"
                    + description
                    + ";"
                    + releaseDate
                    + ";"
                    + cat
                    + ";"
                    + quant
                    + "##";
          }
        }
      } else {
        res = "false";
      }

    } catch (Exception e) {
      e.printStackTrace();
    }

    return res;
  }