connect_error) { die("Could not connect to the database"); } function loadArticles($connection) { $stmt_string = 'SELECT * FROM articles'; $stmt = $connection->prepare($stmt_string) or handle_error($connection); $stmt->execute() or handle_error($connection); $stmt_result = $stmt->get_result() or handle_error($connection); $result = []; while ($row = $stmt_result->fetch_assoc()) { $result[$row['id']] = $row; } return $result; } function handle_error($connection) { die("Query error: " . $connection->error); } $query = parseQuery(); $items = loadArticles($connection, $query); $connection->close(); ?> Items list

Items