setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "
";
die();
}
// Fetch all lines from the database
$lines = $db->query("SELECT * FROM `lines`")->fetchAll(PDO::FETCH_ASSOC);
// Display error message if the database connection is not available
$db ??= null;
if ($db === null) {
echo 'Failed to establish a database connection.';
exit;
}
?>