Пример #1
0
 public function __construct($pID = -1)
 {
     if (is_null(self::$conn)) {
         self::$conn = mysqli_connect('localhost', 'root', 'iti', 'eShop');
     }
     if ($pID != -1) {
         $query = "select * from products where pID={$pID} ";
         $result = mysqli_query(self::$conn, $query);
         // if(mysqli_num_rows($result)>0)
         // {
         $product = mysqli_fetch_assoc($result);
         $this->pID = $product['pID'];
         $this->pName = $product['pName'];
         $this->pPrice = $product['pPrice'];
         $this->pQuantity = $product['pQuantity'];
         $this->pImg = $product['pImg'];
         $this->pDesc = $product['pDesc'];
         $this->scID = $product['scID'];
         // }
         // else
         // }
         // 	return 'undefined';
         // }
     }
 }
Пример #2
0
 public function __construct()
 {
     $servername = "localhost";
     $username = "******";
     $password = "******";
     $dbname = "ecommerce";
     if (is_null(self::$conn)) {
         self::$conn = mysqli_connect('localhost', 'root', 'iti', 'ecommerce');
     }
 }
Пример #3
0
 function __construct($id = -1)
 {
     if (self::$conn == Null) {
         self::$conn = mysqli_connect('localhost', 'root', 'iti', 'store');
     }
 }