public function get_suivi_objet() { require 'ConnectDb.php'; $database = ConnectDb::dbConnect(); $query = 'SELECT * FROM `suivi` WHERE dossier=' . $this->id; $result = mysqli_query($database, $query); $row = mysqli_fetch_array($result); $suivi = new Suivi($row['id'], $this, $row['dateAR'], $row['dateEnvoiComission'], $row['dateComission']); ConnectDb::dbclose($database); return $suivi; }
public static function getInstance() { if (is_null(self::$dbInstance)) { try { self::$dbInstance = new PDO(dsn, user, pass); echo "连接成功"; } catch (PDOException $e) { die("数据库连接失败" . $e->getMessage()); } //header('Location:http://localhost/stumanagerOS/functions/stuOp.php'); } else { return null; } return self::$dbInstance; }
function get_etudiant_nom_objet($nom, $prenom) { $database = ConnectDb::dbConnect(); $query = "SELECT * FROM `etudiant` WHERE nom='" . $nom . "' AND prenom='" . $prenom . "'"; $result = mysqli_query($database, $query); if (!$result) { throw new Exception(); } $row = mysqli_fetch_array($result); ConnectDb::dbclose($database); return new Etudiant($row['id'], $row['login'], $row['nom'], $row['prenom'], $row['email']); }