This commit is contained in:
Hamza-Ayed
2026-05-01 02:08:21 +03:00
parent 989f6332f9
commit e68dda58d3
7 changed files with 119 additions and 69 deletions

View File

@@ -3,16 +3,21 @@ require_once __DIR__ . '/../../connect.php';
$country = filterRequest("country");
$sql = "SELECT * FROM `kazan` WHERE `country` = :country";
$stmt = $con->prepare($sql);
$stmt->bindParam(':country', $country, PDO::PARAM_STR);
$stmt->execute();
if (!empty($country)) {
$sql = "SELECT * FROM `kazan` WHERE `country` = :country";
$stmt = $con->prepare($sql);
$stmt->bindParam(':country', $country, PDO::PARAM_STR);
} else {
$sql = "SELECT * FROM `kazan` ORDER BY id DESC";
$stmt = $con->prepare($sql);
}
$stmt->execute();
$row = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($row) {
jsonSuccess($row);
} else {
jsonError("No Kazan record found");
jsonSuccess([], "No Kazan record found");
}
?>