Pagine la liste des news récentes
This commit is contained in:
1 parent
9519287329
commit
2c8e49e560
5 files changed
+79
-6
No files matched your search
@@ -37,6 +37,15 @@ class NewsGateway
|
||||
return $news;
|
||||
}
|
||||
|
||||
public function getCount(): int
|
||||
{
|
||||
$req = $this->pdo->query('SELECT COUNT(*) nb FROM news;');
|
||||
if ($req === false) {
|
||||
return 0;
|
||||
}
|
||||
return intval($req->fetch()['nb']);
|
||||
}
|
||||
|
||||
public function getById(int $id): News
|
||||
{
|
||||
$req = $this->pdo->prepare('SELECT * FROM news WHERE id_news=:id;');
|
||||
|
||||
Reference in new issue
Block a user