prestation/Modele/Billet.php
2025-12-01 18:54:33 +00:00

25 lines
970 B
PHP

<?php
require_once 'Framework/Modele.php';
class Billet extends Modele {
public function getBillets() {
$sql = 'select BIL_ID as id, BIL_DATE as date,'
. ' BIL_TITRE as titre, BIL_CONTENU as contenu from t_billet'
. ' order by BIL_ID desc';
$billets = $this->executerRequete($sql);
return $billets;
}
public function getBillet($idBillet) {
$sql = 'select BIL_ID as id, BIL_DATE as date,'
. ' BIL_TITRE as titre, BIL_CONTENU as contenu from t_billet'
. ' where BIL_ID=?';
$billet = $this->executerRequete($sql, array($idBillet));
return $billet->fetch(PDO::FETCH_ASSOC);
}
public function getNombreBillets()
{
$sql = 'select count(*) as nbBillets from t_billet';
$resultat = $this->executerRequete($sql);
$ligne = $resultat->fetch(PDO::FETCH_ASSOC);
return $ligne['nbBillets'];
}
}