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