| 123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- require_once(__DIR__."/database.php");
- class Customer_Template
- {
- function __construct()
- {
- $this->db = new Database();
- }
- function set($customer_id, $product_id, $amount, $hint)
- {
- $this->delete($customer_id, $product_id);
- $query = "INSERT INTO ".$this->db->customer_template_table." VALUES('".$customer_id."', '".$product_id."', '".$amount."', '".$hint."')";
- $this->db->query($query);
- }
- function delete($customer_id, $product_id)
- {
- $query = "DELETE FROM ".$this->db->customer_template_table." WHERE customer_id='$customer_id' AND product_id='".$product_id."' ";
- $this->db->query($query);
- }
- function get($customer_id)
- {
- $query = "SELECT * FROM ".$this->db->customer_template_table." WHERE customer_id='".$customer_id."'";
- return $this->db->fetchRows($this->db->query($query));
- }
- function clear($customer_id)
- {
- $query = "DELETE FROM ".$this->db->customer_template_table." WHERE customer_id='$customer_id' ";
- $this->db->query($query);
- }
- }
- ?>
|