update to use single html with dynamic div
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?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>";
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user