2021-12-28 21:22:32 +00:00
|
|
|
<?php
|
|
|
|
namespace api;
|
|
|
|
use PDO;
|
|
|
|
|
|
|
|
require_once "./config.php";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Project Data Class
|
|
|
|
* Define all functions which either get, update, create or delete timeline data
|
|
|
|
*/
|
|
|
|
class projectData
|
|
|
|
{
|
2022-10-09 02:40:06 +01:00
|
|
|
/**
|
|
|
|
* Get all project data
|
|
|
|
* @return array - Array of all project data or error message
|
|
|
|
*/
|
2022-07-29 20:00:36 +01:00
|
|
|
function getProjectData(): array
|
2021-12-28 21:22:32 +00:00
|
|
|
{
|
|
|
|
$conn = dbConn();
|
|
|
|
$stmt = $conn->prepare("SELECT title, isMainProject, information, imgLocation, projectLink, githubLink FROM projects order by date LIMIT 4;");
|
|
|
|
$stmt->execute();
|
|
|
|
|
|
|
|
// set the resulting array to associative
|
|
|
|
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
|
|
|
|
if ($result)
|
|
|
|
{
|
|
|
|
return $result;
|
|
|
|
}
|
2022-07-29 20:00:36 +01:00
|
|
|
return array("errorMessage" => "Error, project data not found");
|
2021-12-28 21:22:32 +00:00
|
|
|
}
|
2022-07-29 20:00:36 +01:00
|
|
|
}
|