public function __construct() { $bdd = ConnexionBD::getInstance(); $operations = $bdd->getData("SELECT * FROM operations"); $i = 0; while ($data = $operations->fetch(PDO::FETCH_OBJ)) { $result = new Operations($data->idOperations, $data->idCompte, $data->typeOperations, $data->titreOperations, $data->contenuOperations, $data->dateOperations); $this->_listeOperations[$i] = $result; $i += 1; } $type = $bdd->getData("SELECT * FROM typeoperations"); $i = 0; while ($data = $type->fetch(PDO::FETCH_OBJ)) { $result = new TypeOperations($data->idType, $data->nomType); $this->_listeType[$i] = $result; $i += 1; } }
<?php require "../Models/ConnexionBD.php"; require "../Models/Message.php"; require "../Models/Operations.php"; $bdd = ConnexionBD::getInstance(); session_start(); function str_random($length) { $chaine = "0123456789azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN"; return substr(str_shuffle(str_repeat($chaine, $length)), 0, $length); }