added more db functions
This commit is contained in:
+22
-8
@@ -13,17 +13,31 @@ define('USER', $db_user);
|
|||||||
define('PASS', $db_pass);
|
define('PASS', $db_pass);
|
||||||
define('DB', 'vintagecodingdotnet');
|
define('DB', 'vintagecodingdotnet');
|
||||||
|
|
||||||
function get_article_cards()
|
/*
|
||||||
|
* For use by an administrator.
|
||||||
|
*
|
||||||
|
* TODO: Use JOIN to get role, profile picture, etc.
|
||||||
|
*/
|
||||||
|
function get_all_accounts()
|
||||||
{
|
{
|
||||||
$conn = mysqli_connect(HOST, USER, PASS, DB);
|
$conn = mysqli_connect(HOST, USER, PASS, DB);
|
||||||
|
|
||||||
$query = 'SELECT * FROM accounts;';
|
$query = 'SELECT * FROM accounts;';
|
||||||
|
|
||||||
$results = mysqli_query($conn, $query);
|
$results = mysqli_query($conn, $query);
|
||||||
echo '<pre>';
|
return $results;
|
||||||
while ($row = mysqli_fetch_array($results)) {
|
|
||||||
print_r($row);
|
|
||||||
echo '<br>';
|
|
||||||
}
|
}
|
||||||
echo '</pre>';
|
|
||||||
|
function get_all_article_cards()
|
||||||
|
{
|
||||||
|
$conn = mysqli_connect(HOST, USER, PASS, DB);
|
||||||
|
$query = 'SELECT article_id, title, slug, featured_image, excerpt FROM articles;';
|
||||||
|
$results = mysqli_query($conn, $query);
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_new_article_cards()
|
||||||
|
{
|
||||||
|
$conn = mysqli_connect(HOST, USER, PASS, DB);
|
||||||
|
$query = 'SELECT article_id, title, slug, featured_image, excerpt FROM articles ORDER BY publish_date;';
|
||||||
|
$results = mysqli_query($conn, $query);
|
||||||
|
return $results;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user