created timelineData function and added it to its route

This commit is contained in:
2021-08-23 09:30:08 +01:00
parent 858831e2c6
commit 102a614214
2 changed files with 38 additions and 6 deletions
+19 -1
View File
@@ -1,7 +1,25 @@
<?php
require_once "./confjg.php"
class TimelineData
{
function getTimelineData()
{
$conn = dbConn();
$stmt = $conn->prepare("SELECT * FROM timeline;");
$stmt->execute();
// set the resulting array to associative
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($result)
{
return $result;
}
else
{
return array("errorMessage" => "Error timeline data not found");
}
}
}