pdo->query("SELECT * FROM user ORDER BY username ASC"); /* (2) Fetched data */ return $st->fetchAll(); } public function getById(int $id_user){ /* (1) Prepare Statement */ $pst = $this->pdo->prepare("SELECT * FROM user WHERE id_user = :id_user"); /* (2) Bind variables */ $pst->bindParam(':id_user', $id_user, \PDO::PARAM_INT); /* (3) Execute */ if( !$pst->execute() ) return false; // if error -> send FALSE /* (4) Fetched data */ return $pst->fetchAll(); } public function getByMail(String $mail){ /* (1) Prepare Statement */ $pst = $this->pdo->prepare("SELECT * FROM user WHERE mail = :mail"); /* (2) Bind variables */ $pst->bindParam(':mail', $mail, \PDO::PARAM_STR, 50); /* (3) Execute */ if( !$pst->execute() ) return false; // if error -> send FALSE /* (4) Fetched data */ return $pst->fetchAll(); } }