prepare("SELECT title, information, imgLocation, projectLink, githubLink FROM projects;"); $stmt->execute(); // set the resulting array to associative $result = $stmt->fetchAll(PDO::FETCH_ASSOC); if ($result) { return $result; } else { return array(array("errorMessage" => "Error, project data not found")); } } }