Linked backend with frontend and styled curriculum vitae for mobile
This commit is contained in:
+2
-2
@@ -40,7 +40,7 @@ $app->get("/timelineData/{timeline}", function (Request $request, Response $resp
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = array("errorMessage" => "Error, timeline data not found");
|
||||
$result = array(array("errorMessage" => "Error, timeline data not found"));
|
||||
}
|
||||
|
||||
$json = json_encode($result);
|
||||
@@ -48,7 +48,7 @@ $app->get("/timelineData/{timeline}", function (Request $request, Response $resp
|
||||
$response->getBody()->write($json);
|
||||
|
||||
//if it is an error give a 404 code since it can't find the data
|
||||
if(array_key_exists(“errorMessage”, $result))
|
||||
if(array_key_exists("errorMessage", $result[0]))
|
||||
{
|
||||
$response = $response->withStatus(404);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
<?php
|
||||
require_once "./config.php";
|
||||
|
||||
/**
|
||||
* TimelineData class
|
||||
* Define all functions which either get, update, create or delete timeline data
|
||||
*/
|
||||
class TimelineData
|
||||
{
|
||||
function getEduData()
|
||||
{
|
||||
$conn = dbConn();
|
||||
$stmt = $conn->prepare("SELECT * FROM edu;");
|
||||
$stmt = $conn->prepare("SELECT DATE_FORMAT(startPeriod, '%b, %Y') as startPeriod, DATE_FORMAT(endPeriod, '%b, %Y') as endPeriod, grade, course FROM edu ORDER BY startPeriod DESC;");
|
||||
$stmt->execute();
|
||||
|
||||
// set the resulting array to associative
|
||||
@@ -18,14 +22,14 @@ class TimelineData
|
||||
}
|
||||
else
|
||||
{
|
||||
return array("errorMessage" => "Error, edu data not found");
|
||||
return array(array("errorMessage" => "Error, edu data not found"));
|
||||
}
|
||||
}
|
||||
|
||||
function getWorkData()
|
||||
{
|
||||
$conn = dbConn();
|
||||
$stmt = $conn->prepare("SELECT * FROM work;");
|
||||
$stmt = $conn->prepare("SELECT DATE_FORMAT(startPeriod, '%b, %Y') as startPeriod, DATE_FORMAT(endPeriod, '%b, %Y') as endPeriod, companyName, area, title FROM work ORDER BY startPeriod DESC;");
|
||||
$stmt->execute();
|
||||
|
||||
// set the resulting array to associative
|
||||
@@ -37,7 +41,7 @@ class TimelineData
|
||||
}
|
||||
else
|
||||
{
|
||||
return array("errorMessage" => "Error, work data not found");
|
||||
return array(array("errorMessage" => "Error, work data not found"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user