memperbaiki koneksi database pada project 1 dan project 2
This commit is contained in:
@@ -1,18 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
// Konfigurasi Database (Sesuaikan)
|
require_once '../config.php';
|
||||||
$host = "localhost";
|
$conn = getDB();
|
||||||
$user = "root";
|
|
||||||
$pass = "";
|
|
||||||
$db = "webgis"; // UBAH INI
|
|
||||||
|
|
||||||
$conn = new mysqli($host, $user, $pass, $db);
|
|
||||||
|
|
||||||
if ($conn->connect_error) {
|
|
||||||
echo json_encode(["status" => "error", "message" => "Koneksi database gagal"]);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = json_decode(file_get_contents("php://input"), true);
|
$data = json_decode(file_get_contents("php://input"), true);
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
// Konfigurasi Database (Sesuaikan dengan milik Anda)
|
require_once '../config.php';
|
||||||
$host = "localhost";
|
$conn = getDB();
|
||||||
$user = "root";
|
|
||||||
$pass = "";
|
|
||||||
$db = "webgis"; // UBAH INI
|
|
||||||
|
|
||||||
$conn = new mysqli($host, $user, $pass, $db);
|
|
||||||
|
|
||||||
if ($conn->connect_error) {
|
|
||||||
echo json_encode(["status" => "error", "message" => "Koneksi database gagal"]);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ambil semua data dari tabel spbu_point
|
// Ambil semua data dari tabel spbu_point
|
||||||
$sql = "SELECT * FROM spbu_point";
|
$sql = "SELECT * FROM spbu_point";
|
||||||
|
|||||||
@@ -4,18 +4,8 @@
|
|||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
// Konfigurasi Database (Sesuaikan dengan milik Anda)
|
// Konfigurasi Database (Sesuaikan dengan milik Anda)
|
||||||
$host = "localhost";
|
require_once '../config.php';
|
||||||
$user = "root";
|
$conn = getDB();
|
||||||
$pass = "";
|
|
||||||
$db = "webgis"; // UBAH INI!
|
|
||||||
|
|
||||||
// Koneksi ke database
|
|
||||||
$conn = new mysqli($host, $user, $pass, $db);
|
|
||||||
|
|
||||||
if ($conn->connect_error) {
|
|
||||||
echo json_encode(["status" => "error", "message" => "Koneksi database gagal"]);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ambil data JSON yang dikirim oleh Fetch API
|
// Ambil data JSON yang dikirim oleh Fetch API
|
||||||
$data = json_decode(file_get_contents("php://input"), true);
|
$data = json_decode(file_get_contents("php://input"), true);
|
||||||
|
|||||||
@@ -2,17 +2,8 @@
|
|||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
// Konfigurasi Database (Sesuaikan dengan milik Anda)
|
// Konfigurasi Database (Sesuaikan dengan milik Anda)
|
||||||
$host = "localhost";
|
require_once '../config.php';
|
||||||
$user = "root";
|
$conn = getDB();
|
||||||
$pass = "";
|
|
||||||
$db = "webgis"; // UBAH INI
|
|
||||||
|
|
||||||
$conn = new mysqli($host, $user, $pass, $db);
|
|
||||||
|
|
||||||
if ($conn->connect_error) {
|
|
||||||
echo json_encode(["status" => "error", "message" => "Koneksi database gagal"]);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = json_decode(file_get_contents("php://input"), true);
|
$data = json_decode(file_get_contents("php://input"), true);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
$conn = new mysqli("localhost", "root", "", "webgis"); // UBAH DB
|
require_once '../config.php';
|
||||||
|
$conn = getDB();
|
||||||
|
|
||||||
$data = json_decode(file_get_contents("php://input"), true);
|
$data = json_decode(file_get_contents("php://input"), true);
|
||||||
if ($data && isset($data['id'])) {
|
if ($data && isset($data['id'])) {
|
||||||
|
|||||||
@@ -2,17 +2,8 @@
|
|||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
// Konfigurasi Database (Sesuaikan dengan milik Anda)
|
// Konfigurasi Database (Sesuaikan dengan milik Anda)
|
||||||
$host = "localhost";
|
require_once '../config.php';
|
||||||
$user = "root";
|
$conn = getDB();
|
||||||
$pass = "";
|
|
||||||
$db = "webgis"; // UBAH INI
|
|
||||||
|
|
||||||
$conn = new mysqli($host, $user, $pass, $db);
|
|
||||||
|
|
||||||
if ($conn->connect_error) {
|
|
||||||
echo json_encode(["status" => "error", "message" => "Koneksi database gagal"]);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = json_decode(file_get_contents("php://input"), true);
|
$data = json_decode(file_get_contents("php://input"), true);
|
||||||
|
|
||||||
|
|||||||
@@ -2,17 +2,8 @@
|
|||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
// Konfigurasi Database (Sesuaikan)
|
// Konfigurasi Database (Sesuaikan)
|
||||||
$host = "localhost";
|
require_once '../config.php';
|
||||||
$user = "root";
|
$conn = getDB();
|
||||||
$pass = "";
|
|
||||||
$db = "webgis"; // UBAH INI
|
|
||||||
|
|
||||||
$conn = new mysqli($host, $user, $pass, $db);
|
|
||||||
|
|
||||||
if ($conn->connect_error) {
|
|
||||||
echo json_encode(["status" => "error", "message" => "Koneksi database gagal"]);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = json_decode(file_get_contents("php://input"), true);
|
$data = json_decode(file_get_contents("php://input"), true);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
$conn = new mysqli("localhost", "root", "", "webgis");
|
require_once '../config.php';
|
||||||
|
$conn = getDB();
|
||||||
|
|
||||||
$sql = "SELECT * FROM area_polygon";
|
$sql = "SELECT * FROM area_polygon";
|
||||||
$result = $conn->query($sql);
|
$result = $conn->query($sql);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
$conn = new mysqli("localhost", "root", "", "webgis"); // UBAH DB
|
require_once '../config.php';
|
||||||
|
$conn = getDB();
|
||||||
|
|
||||||
$sql = "SELECT * FROM jalan_polyline";
|
$sql = "SELECT * FROM jalan_polyline";
|
||||||
$result = $conn->query($sql);
|
$result = $conn->query($sql);
|
||||||
|
|||||||
@@ -2,17 +2,8 @@
|
|||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
// Konfigurasi Database (Sesuaikan dengan milik Anda)
|
// Konfigurasi Database (Sesuaikan dengan milik Anda)
|
||||||
$host = "localhost";
|
require_once '../config.php';
|
||||||
$user = "root";
|
$conn = getDB();
|
||||||
$pass = "";
|
|
||||||
$db = "webgis"; // UBAH INI
|
|
||||||
|
|
||||||
$conn = new mysqli($host, $user, $pass, $db);
|
|
||||||
|
|
||||||
if ($conn->connect_error) {
|
|
||||||
echo json_encode(["status" => "error", "message" => "Koneksi database gagal"]);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ambil semua data dari tabel spbu_point
|
// Ambil semua data dari tabel spbu_point
|
||||||
$sql = "SELECT * FROM spbu_point";
|
$sql = "SELECT * FROM spbu_point";
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
$conn = new mysqli("localhost", "root", "", "webgis");
|
require_once '../config.php';
|
||||||
|
$conn = getDB();
|
||||||
|
|
||||||
$data = json_decode(file_get_contents("php://input"), true);
|
$data = json_decode(file_get_contents("php://input"), true);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
$conn = new mysqli("localhost", "root", "", "webgis"); // UBAH DB
|
require_once '../config.php';
|
||||||
|
$conn = getDB();
|
||||||
|
|
||||||
$data = json_decode(file_get_contents("php://input"), true);
|
$data = json_decode(file_get_contents("php://input"), true);
|
||||||
|
|
||||||
|
|||||||
@@ -4,18 +4,8 @@
|
|||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
// Konfigurasi Database (Sesuaikan dengan milik Anda)
|
// Konfigurasi Database (Sesuaikan dengan milik Anda)
|
||||||
$host = "localhost";
|
require_once '../config.php';
|
||||||
$user = "root";
|
$conn = getDB();
|
||||||
$pass = "";
|
|
||||||
$db = "webgis"; // UBAH INI!
|
|
||||||
|
|
||||||
// Koneksi ke database
|
|
||||||
$conn = new mysqli($host, $user, $pass, $db);
|
|
||||||
|
|
||||||
if ($conn->connect_error) {
|
|
||||||
echo json_encode(["status" => "error", "message" => "Koneksi database gagal"]);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ambil data JSON yang dikirim oleh Fetch API
|
// Ambil data JSON yang dikirim oleh Fetch API
|
||||||
$data = json_decode(file_get_contents("php://input"), true);
|
$data = json_decode(file_get_contents("php://input"), true);
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
// Sesuaikan dengan konfigurasi database Anda
|
// Sesuaikan dengan konfigurasi database Anda
|
||||||
$conn = new mysqli("localhost", "root", "", "webgis");
|
require_once '../config.php';
|
||||||
|
$conn = getDB();
|
||||||
if ($conn->connect_error) {
|
|
||||||
echo json_encode(["status" => "error", "message" => "Koneksi database gagal"]);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = json_decode(file_get_contents("php://input"), true);
|
$data = json_decode(file_get_contents("php://input"), true);
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
// Sesuaikan dengan konfigurasi database Anda
|
// Sesuaikan dengan konfigurasi database Anda
|
||||||
$conn = new mysqli("localhost", "root", "", "webgis");
|
require_once '../config.php';
|
||||||
|
$conn = getDB();
|
||||||
if ($conn->connect_error) {
|
|
||||||
echo json_encode(["status" => "error", "message" => "Koneksi database gagal"]);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = json_decode(file_get_contents("php://input"), true);
|
$data = json_decode(file_get_contents("php://input"), true);
|
||||||
|
|
||||||
|
|||||||
@@ -2,17 +2,8 @@
|
|||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
// Konfigurasi Database (Sesuaikan dengan milik Anda)
|
// Konfigurasi Database (Sesuaikan dengan milik Anda)
|
||||||
$host = "localhost";
|
require_once '../config.php';
|
||||||
$user = "root";
|
$conn = getDB();
|
||||||
$pass = "";
|
|
||||||
$db = "webgis"; // UBAH INI
|
|
||||||
|
|
||||||
$conn = new mysqli($host, $user, $pass, $db);
|
|
||||||
|
|
||||||
if ($conn->connect_error) {
|
|
||||||
echo json_encode(["status" => "error", "message" => "Koneksi database gagal"]);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = json_decode(file_get_contents("php://input"), true);
|
$data = json_decode(file_get_contents("php://input"), true);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user