admin 20
This commit is contained in:
@@ -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");
|
||||
}
|
||||
?>
|
||||
@@ -5,7 +5,7 @@ $id = filterRequest("id");
|
||||
|
||||
$allowedFields = [
|
||||
"kazan", "comfortPrice", "speedPrice", "deliveryPrice",
|
||||
"freePrice", "latePrice", "heavyPrice", "adminId", "createdAt", "naturePrice"
|
||||
"freePrice", "latePrice", "heavyPrice", "adminId", "naturePrice", "fuelPrice", "familyPrice"
|
||||
];
|
||||
|
||||
$setParts = [];
|
||||
@@ -33,6 +33,7 @@ $stmt->execute($params);
|
||||
if ($stmt->rowCount() > 0) {
|
||||
jsonSuccess(null, "Kazan data updated successfully");
|
||||
} else {
|
||||
jsonError("Failed to update kazan data");
|
||||
// If no rows were changed but execute was successful, it might be because the data is the same
|
||||
jsonSuccess(null, "Kazan data remains unchanged or updated");
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user