32 lines
814 B
PHP
32 lines
814 B
PHP
<?php
|
|
require_once __DIR__ . "/../config/db.php";
|
|
|
|
function getProjects($mysqli){
|
|
$sql = "SELECT * FROM projects ORDER BY id DESC";
|
|
$result = $mysqli->query($sql);
|
|
|
|
if ($result && $result->num_rows > 0) {
|
|
// Loop through the database rows and push names into the array
|
|
while ($row = $result->fetch_assoc()) {
|
|
$projects[] = $row;
|
|
}
|
|
}
|
|
|
|
return $projects;
|
|
}
|
|
|
|
function getThreeProjects($mysqli){
|
|
$sql = "SELECT * FROM projects ORDER BY id DESC LIMIT 3";
|
|
$result = $mysqli->query($sql);
|
|
|
|
if ($result && $result->num_rows > 0) {
|
|
// Loop through the database rows and push names into the array
|
|
while ($row = $result->fetch_assoc()) {
|
|
$projects[] = $row;
|
|
}
|
|
}
|
|
|
|
return $projects;
|
|
}
|
|
|
|
?>
|