Being able to edit a timeline item fully working as currently tested.

Signed-off-by: rodude123 <rodude123@gmail.com>
This commit is contained in:
2022-10-09 23:32:50 +01:00
parent a5c7d16991
commit 7b04af165e
10 changed files with 163 additions and 44 deletions
+23 -2
View File
@@ -17,7 +17,7 @@ class timelineData
function getEduData(): array
{
$conn = dbConn();
$stmt = $conn->prepare("SELECT startPeriod, endPeriod, grade, course FROM edu ORDER BY startPeriod DESC;");
$stmt = $conn->prepare("SELECT ID, startPeriod, endPeriod, grade, course FROM edu ORDER BY startPeriod DESC;");
$stmt->execute();
// set the resulting array to associative
@@ -49,5 +49,26 @@ class timelineData
}
return array("errorMessage" => "Error, work data not found");
}
/**
* Update education data
* @param string $dateFrom - Start date
* @param string $dateTo - End date
* @param string $grade - Grade
* @param string $course - Course
* @param string $id - ID of the education data
* @return bool - True if successful, false if not
*/
function updateEduData(string $dateFrom, string $dateTo, string $grade, string $course, string $id): bool
{
$conn = dbConn();
$stmt = $conn->prepare("UPDATE edu SET startPeriod = :dateFrom, endPeriod = :dateTo, grade = :grade, course = :course WHERE ID = :id;");
$stmt->bindParam(":dateFrom", $dateFrom);
$stmt->bindParam(":dateTo", $dateTo);
$stmt->bindParam(":grade", $grade);
$stmt->bindParam(":course", $course);
$stmt->bindParam(":id", $id);
return $stmt->execute();
}
}