Add Pharmacy
All Pharmacies:
include 'db.php';
$sql = "SELECT * FROM pharmacies";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo "
";
echo "
";
echo "" . $row['name'] . "
";
echo "
ID: " . $row['id'] . "
Address: " . $row['address'] . "
Phone: " . $row['phone'] . "
";
echo "
";
echo "
";
}
} else {
echo "
No pharmacies found.
";
}
$conn->close();
?>
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$search = $_POST['search'];
$sql = "SELECT * FROM pharmacies WHERE name LIKE '%$search%'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "
Search Results:
";
while ($row = $result->fetch_assoc()) {
echo "
";
echo "
";
echo "
" . $row['name'] . "
";
echo "
ID: " . $row['id'] . "
Address: " . $row['address'] . "
Phone: " . $row['phone'] . "
";
echo "";
echo "
";
}
} else {
echo "
No results found.
";
}
}
?>