public function __construct($id = -1) { if (is_null(self::$conn)) { self::$conn = mysqli_connect('localhost', 'root', 'iti', 'itians'); } if ($id != -1) { $query = "select * from track where id={$id} "; $result = mysqli_query(self::$conn, $query); $track = mysqli_fetch_assoc($result); $this->id = $track['id']; $this->name = $track['name ']; $this->sup_id = $track['psup_id ']; $this->no_course = $track['pno_course']; $this->no_stud = $track['no_stud']; $this->leader_id = $track['leader_id']; } }