fitur penanda jalan rusak

This commit is contained in:
Farha
2026-04-14 10:52:05 +07:00
parent eee1e89cbc
commit aa3fe296c1
6 changed files with 480 additions and 8 deletions
+24
View File
@@ -0,0 +1,24 @@
<?php
// Script untuk membuat tabel jalan_rusak jika belum ada
include 'db_config.php';
$sql = "CREATE TABLE IF NOT EXISTS jalan_rusak (
id INT AUTO_INCREMENT PRIMARY KEY,
latitude DECIMAL(10, 8) NOT NULL,
longitude DECIMAL(11, 8) NOT NULL,
jenis_kerusakan VARCHAR(100) NOT NULL COMMENT 'Jenis: lubang, retak, ambles, dll',
deskripsi TEXT,
severity VARCHAR(50) DEFAULT 'sedang' COMMENT 'tertarik: ringan, sedang, berat',
gambar VARCHAR(255),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
INDEX idx_coords (latitude, longitude)
)";
if ($conn->query($sql) === TRUE) {
echo json_encode(['status' => 'success', 'message' => 'Tabel jalan_rusak berhasil dibuat atau sudah ada']);
} else {
echo json_encode(['status' => 'error', 'message' => $conn->error]);
}
$conn->close();
?>