Ejemplo n.º 1
0
 public function __construct()
 {
     $servername = "localhost";
     $username = "******";
     $password = "******";
     $dbname = "ecommerce";
     if (is_null(self::$conn)) {
         self::$conn = mysqli_connect('localhost', 'root', 'iti', 'ecommerce');
     }
 }
 function __construct($id = -1)
 {
     if (self::$conn == Null) {
         self::$conn = mysqli_connect('localhost', 'root', 'iti', 'babyshop');
     }
     if ($id != -1) {
         $query = "select * from types where tid={$id} limit 1";
         $result = mysqli_query(self::$conn, $query);
         $cat = mysqli_fetch_assoc($result);
         $this->id = $cat['tid'];
         $this->name = $cat['name'];
     }
 }