Customer_Template.php 986 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. require_once("DataBase/database.php");
  3. class Customer_Template
  4. {
  5. function __construct()
  6. {
  7. $this->db = new Database();
  8. }
  9. function set($customer_id, $product_id, $amount, $hint)
  10. {
  11. $this->delete($customer_id, $product_id);
  12. $query = "INSERT INTO ".$this->db->customer_template_table." VALUES('".$customer_id."', '".$product_id."', '".$amount."', '".$hint."')";
  13. $this->db->query($query);
  14. }
  15. function delete($customer_id, $product_id)
  16. {
  17. $query = "DELETE FROM ".$this->db->customer_template_table." WHERE customer_id='$customer_id' AND product_id='".$product_id."' ";
  18. $this->db->query($query);
  19. }
  20. function get($customer_id)
  21. {
  22. $query = "SELECT * FROM ".$this->db->customer_template_table." WHERE customer_id='".$customer_id."'";
  23. return $this->db->fetchRows($this->db->query($query));
  24. }
  25. function clear($customer_id)
  26. {
  27. $query = "DELETE FROM ".$this->db->customer_template_table." WHERE customer_id='$customer_id' ";
  28. $this->db->query($query);
  29. }
  30. }
  31. ?>