bcom/clazz/2/Article.class.php

28 lines
533 B
PHP

<?php
class Article {
public static function getNewest($count){
$req = $GLOBALS['bdd']->prepare('SELECT * FROM articles ORDER BY lastNoticeableChangeDate DESC LIMIT '.intval($count));
$req->execute();
$reps = array();
while($rep = $req->fetch()){
$reps[] = array();
$reps[count($reps)-1]['title'] = $rep['title'];
$reps[count($reps)-1]['short'] = $rep['short'];
$reps[count($reps)-1]['text'] = $rep['text'];
$reps[count($reps)-1]['picPath'] = $rep['picPath'];
}
return $reps;
}
}