function __construct($id = -1)
 {
     if (self::$conn == Null) {
         self::$conn = mysqli_connect('localhost', 'root', 'iti', 'babyshop');
     }
     if ($id != -1) {
         $query = "select * from products where pId={$id} limit 1";
         $result = mysqli_query(self::$conn, $query);
         $product = mysqli_fetch_assoc($result);
         $this->id = $product['pId'];
         $this->name = $product['name'];
         $this->descr = $product['descr'];
         $this->quantity = $product['quantity'];
         $this->image = $product['image'];
         $this->price = $product['price'];
     }
 }
Example #2
0
 function __construct($id = -1)
 {
     if (self::$conn == Null) {
         self::$conn = mysqli_connect('localhost', 'root', 'root', 'Commerce');
     }
     if ($id != -1) {
         $query = "select * from product where id={$id} limit 1";
         $result = mysqli_query(self::$conn, $query);
         $pro = mysqli_fetch_assoc($result);
         $this->id = $pro['id'];
         $this->name = $pro['name'];
         $this->des_product = $pro['des_product'];
         $this->quantity = $pro['quantity'];
         $this->price = $pro['price'];
         $this->image = $pro['image'];
         $this->cat_id = $pro['cat_id'];
     }
 }
Example #3
0
 function __construct($id = -1)
 {
     if (self::$conn == Null) {
         self::$conn = mysqli_connect('localhost', 'root', 'iti', 'clothes_shop');
     }
     if ($id != -1) {
         $query = "select * from products where id={$id} limit 1";
         $result = mysqli_query(self::$conn, $query);
         $product = mysqli_fetch_assoc($result);
         $this->id = $product['id'];
         $this->sub_id = $product['sub_id'];
         $this->price = $product['price'];
         $this->color = $product['color'];
         $this->discount = $product['discount'];
         $this->material = $product['material'];
         $this->qty = $product['qty'];
         $this->size = $product['size'];
     }
 }
Example #4
0
 function __construct($id = -1)
 {
     if (self::$conn == Null) {
         self::$conn = mysqli_connect('localhost', 'root', 'iti', 'GEO');
     }
     if ($id != -1) {
         $query = "select * from product where id_product={$id_product}  limit 1";
         $result = mysqli_query(self::$conn, $query);
         $prod = mysqli_fetch_assoc($result);
         $this->id_product = $prod['id_product'];
         $this->id_cato = $prod['id_cato'];
         $this->id_sub = $prod['id_sub'];
         $this->type_prod = $prod['type_prod'];
         $this->descrp = $prod['descrp'];
         $this->image = $prod['image'];
         $this->quantity = $prod['quantity'];
         $this->unit_price = $prod['unit_price'];
     }
 }
Example #5
0
 function __construct($id = -1)
 {
     if (self::$conn == Null) {
         self::$conn = mysqli_connect('localhost', 'root', 'iti', 'store');
     }
     if ($id != -1) {
         $query = "select * from products where id={$id} limit 1";
         $result = mysqli_query(self::$conn, $query);
         $product = mysqli_fetch_assoc($result);
         $this->id = $product['id'];
         $this->name = $product['name'];
         /*$this->$sub_cat_id = $product['$sub_cat_id'];
         		$this->image = $product['image'];
         		$this->price = $product['price'];
         		$this->color = $product['color'];
         		$this->size = $product['size'];
         		$this->quantity=$product['quantity'];
         		$this->add_date=$product['add_date'];
         		$this->status=$product['status'];*/
     }
 }