prepare("SELECT startPeriod, endPeriod, grade, course FROM edu ORDER BY startPeriod DESC;"); $stmt->execute(); // set the resulting array to associative $result = $stmt->fetchAll(PDO::FETCH_ASSOC); if ($result) { return $result; } return array("errorMessage" => "Error, edu data not found"); } /** * Get all work data * @return array - Array of all work data or error message */ function getWorkData(): array { $conn = dbConn(); $stmt = $conn->prepare("SELECT startPeriod, endPeriod, companyName, area, title FROM work ORDER BY work.startPeriod DESC;"); $stmt->execute(); // set the resulting array to associative $result = $stmt->fetchAll(PDO::FETCH_ASSOC); if ($result) { return $result; } return array("errorMessage" => "Error, work data not found"); } }