Example #1
0
 function __construct($id = -1)
 {
     if (self::$conn == Null) {
         self::$conn = mysqli_connect('localhost', 'root', 'iti', 'eShop');
     }
     if ($id != -1) {
         $query = "select * from categories where cID={$id} limit 1";
         $result = mysqli_query(self::$conn, $query);
         $category = mysqli_fetch_assoc($result);
         $this->cID = $category['cID'];
         $this->cName = $category['cName'];
     }
 }
Example #2
0
 function __construct($id = -1)
 {
     if (self::$conn == Null) {
         self::$conn = mysqli_connect('localhost', 'root', 'iti', 'store');
     }
 }