refactor: migrate API scripts to a centralized directory and implement shared database configuration
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
require_once __DIR__ . '/config.php';
|
||||
$conn = getDB();
|
||||
|
||||
$name = $_POST['name'];
|
||||
$lat = $_POST['lat'];
|
||||
$lng = $_POST['lng'];
|
||||
$radius = $_POST['radius'];
|
||||
$type = $_POST['type'];
|
||||
$address = $_POST['address']; // Capture the address
|
||||
|
||||
$stmt = $conn->prepare("INSERT INTO worship_places (name, lat, lng, radius, type, address) VALUES (?, ?, ?, ?, ?, ?)");
|
||||
$stmt->bind_param("ssdiss", $name, $lat, $lng, $radius, $type, $address);
|
||||
|
||||
if ($stmt->execute()) {
|
||||
echo json_encode(["id" => $conn->insert_id]);
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user