Add-DAO #14

Merged
tyler merged 3 commits from Add-DAO into master 2022-12-23 21:16:01 +00:00
Showing only changes of commit 61e0fba181 - Show all commits

View File

@ -25,17 +25,17 @@ class Article {
$this->client = mysqli_connect($host, $user, $pass, $db);
}
function getAllPosts() {
public function getAllPosts() {
$result = mysqli_query($this->client, 'SELECT * FROM post');
return mysqli_fetch_all($result);
}
function getMostRecentPosts($limit){
public function getMostRecentPosts($limit){
$result = mysqli_query($this->client, 'SELECT * FROM post ORDER BY created DESC LIMIT ' . $limit);
return mysqli_fetch_all($result);
}
function getPostData($postId) {
public function getPostData($postId) {
$result = mysqli_query($this->client, 'SELECT * FROM post WHERE ID = ' . $postId);
return mysqli_fetch_all($result);
}