Add article page
This commit is contained in:
20
lib/newsarticle.php
Normal file
20
lib/newsarticle.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
function getNewsArticles() :array
|
||||
{
|
||||
global $mysqli;
|
||||
|
||||
$articles = [];
|
||||
if (isLoggedIn()) {
|
||||
$result = $mysqli->query("SELECT NewsArticles.ID, NewsArticles.WrittenAt, NewsArticles.WrittenBy, NewsArticles.Title, NewsArticles.Body, NewsArticles.FileList Users.Nickname FROM NewsArticles INNER JOIN Users ON NewsArticles.WrittenBy = Users.ID; ");
|
||||
|
||||
// Check if the query executed Successfully
|
||||
if ($result) {
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$articles[] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $articles;
|
||||
}
|
Reference in New Issue
Block a user