my-portfolio/dist/api/projectData.php
rodude123 90a3e4f533 Added in editor login feature to login into editor
Signed-off-by: rodude123 <rodude123@gmail.com>
2022-07-29 20:00:36 +01:00

29 lines
693 B
PHP

<?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
{
function getProjectData(): array
{
$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;
}
return array("errorMessage" => "Error, project data not found");
}
}