Zmiany w API
This commit is contained in:
@@ -6,11 +6,10 @@ if ($_POST) {
|
||||
|
||||
// === Dodajemy miejsce ===
|
||||
$stmt = $pdo->prepare("
|
||||
INSERT INTO salon_places (type, name, woj)
|
||||
VALUES (?, ?, ?)
|
||||
INSERT INTO salon_places (name, woj)
|
||||
VALUES (?, ?)
|
||||
");
|
||||
$stmt->execute([
|
||||
$_POST['type'],
|
||||
$_POST['name'],
|
||||
$_POST['woj'] ?: null
|
||||
]);
|
||||
@@ -19,7 +18,7 @@ if ($_POST) {
|
||||
|
||||
// === Dodajemy sklep (shop) ===
|
||||
$stmt = $pdo->prepare("
|
||||
INSERT INTO shops (place_id, address, open_hours, url_address, lat, lng)
|
||||
INSERT INTO shops (place_id, address, open_hours, url_address, url_shop, lat, lng)
|
||||
VALUES (?, ?, ?, ?, ?, ?)
|
||||
");
|
||||
$stmt->execute([
|
||||
@@ -27,6 +26,7 @@ if ($_POST) {
|
||||
$_POST['address'] ?: null,
|
||||
$_POST['open_hours'] ?: null,
|
||||
$_POST['url_address'],
|
||||
$_POST['url_shop'],
|
||||
$_POST['lat'],
|
||||
$_POST['lng'],
|
||||
]);
|
||||
|
||||
@@ -15,9 +15,8 @@ $shops = $shops->fetchAll();
|
||||
|
||||
if ($_POST) {
|
||||
// Aktualizujemy miejsce
|
||||
$pdo->prepare("UPDATE salon_places SET type=?, name=?, woj=? WHERE id=?")
|
||||
$pdo->prepare("UPDATE salon_places SET name=?, woj=? WHERE id=?")
|
||||
->execute([
|
||||
$_POST['type'],
|
||||
$_POST['name'],
|
||||
$_POST['woj'] ?: null,
|
||||
$id
|
||||
@@ -27,12 +26,13 @@ if ($_POST) {
|
||||
$shopId = $shops[0]['id'] ?? null;
|
||||
if ($shopId) {
|
||||
$pdo->prepare("
|
||||
UPDATE shops SET address=?, open_hours=?, url_address=?, lat=?, lng=?
|
||||
UPDATE shops SET address=?, open_hours=?, url_address=?, url_shop=?, lat=?, lng=?
|
||||
WHERE id=?
|
||||
")->execute([
|
||||
$_POST['address'] ?: null,
|
||||
$_POST['open_hours'] ?: null,
|
||||
$_POST['url_address'],
|
||||
$_POST['url_shop'],
|
||||
$_POST['lat'],
|
||||
$_POST['lng'],
|
||||
$shopId
|
||||
|
||||
Reference in New Issue
Block a user