22 lines
596 B
PHP
22 lines
596 B
PHP
<?php
|
|
include 'db_connection.php';
|
|
|
|
$stmt = $db->prepare("SELECT id, name, maps_link FROM Restaurant");
|
|
$stmt->execute();
|
|
$restaurants = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
if ($restaurants) {
|
|
$output = "<ul>";
|
|
foreach ($restaurants as $restaurant) {
|
|
$output .= "<li>Name: {$restaurant['name']}";
|
|
if ($restaurant['maps_link']) {
|
|
$output .= " - <a href='{$restaurant['maps_link']}' target='_blank'>View on Maps</a>";
|
|
}
|
|
$output .= "</li>";
|
|
}
|
|
$output .= "</ul>";
|
|
echo $output;
|
|
} else {
|
|
echo "<p>No restaurants available.</p>";
|
|
}
|
|
?>
|