Initial commit untuk UAS SIG
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
// ============================================
|
||||
// koneksi.php — Konfigurasi Database
|
||||
// ============================================
|
||||
|
||||
define('DB_HOST', 'localhost');
|
||||
define('DB_USER', 'root'); // Sesuaikan dengan user MySQL Anda
|
||||
define('DB_PASS', ''); // Sesuaikan dengan password MySQL Anda
|
||||
define('DB_NAME', 'webgis_spbu');
|
||||
|
||||
function getConnection(): mysqli {
|
||||
$conn = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
|
||||
|
||||
if ($conn->connect_error) {
|
||||
http_response_code(500);
|
||||
echo json_encode(['success' => false, 'message' => 'Koneksi database gagal: ' . $conn->connect_error]);
|
||||
exit;
|
||||
}
|
||||
|
||||
$conn->set_charset('utf8mb4');
|
||||
return $conn;
|
||||
}
|
||||
Reference in New Issue
Block a user