forked from Adleraci/adlerka.top
20 lines
637 B
PHP
20 lines
637 B
PHP
<?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;
|
|
} |