<?php include 'includes/header.php'; ?>
<?php include 'includes/sidebar.php'; ?>
<?php require 'includes/db_connect.php'; ?>

<?php
// $id = $_GET['id'];
// $result = $conn->query("SELECT * FROM streets WHERE id=$id");
// $street = $result->fetch_assoc();

// if (!$street) {
//     echo "<div class='alert alert-danger'>Street not found.</div>";
//     exit;
// }


$id = intval($_GET['id']);

$sql = "SELECT * FROM registered_streets WHERE street_id = $id";
$result = $conn->query($sql);

if (!$result) {
    die("Query failed: " . $conn->error);
}

$row = $result->fetch_assoc();

if (!$row) {
    die("No street found with this ID");
}
?>

<h3 class="text-orange fw-bold">Street Details</h3>

<div class="card shadow mt-4">
    <div class="card-body">

        <h4 class="text-orange"><?= $row['street_name'] ?></h4>
        <p><strong>Name:</strong> <?= $row['fullname'] ?></p>
         <p><strong>Street Registration Number:</strong> <?= $row['reg_no'] ?></p>
          <p><strong>LGA:</strong> <?= $row['lga'] ?></p>
        <p><strong>Location:</strong> <?= $row['town'] ?></p>
         <p><strong>Address:</strong> <?= $row['address'] ?></p>
          <p><strong>Phone number:</strong> <?= $row['phone'] ?></p>
       
       
        <p><strong>Year of Approval:</strong> <?= $row['approval_year'] ?></p>

        <!-- <a href="edit_street.php?id=< //$row['street_id'] ?" class="btn btn-warning text-white">Edit</a> -->
        <a href="street_naming.php" class="btn btn-secondary">Back</a>
    </div>
</div>

<?php include 'includes/footer.php'; ?>
