first commit

This commit is contained in:
2026-06-11 21:14:16 +07:00
parent b08a058a34
commit 027f1cc26b
28 changed files with 3428 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
<?php
include 'koneksi.php';
$idRaw = $_POST['id'] ?? null;
$id = filter_var($idRaw, FILTER_VALIDATE_INT);
$namaKepalaKeluarga = trim($_POST['nama_kepala_keluarga'] ?? '');
$jumlahKkRaw = $_POST['jumlah_kk'] ?? null;
$jumlahKk = filter_var($jumlahKkRaw, FILTER_VALIDATE_INT);
$alamat = trim($_POST['alamat'] ?? '');
if ($id === false || $id === null || $id <= 0 || $namaKepalaKeluarga === '' || $jumlahKk === false || $jumlahKk === null || $jumlahKk < 1 || $alamat === '') {
http_response_code(400);
exit('error');
}
$statement = mysqli_prepare(
$conn,
"UPDATE kemiskinan SET nama_kepala_keluarga = ?, jumlah_kk = ?, alamat = ? WHERE id = ?"
);
mysqli_stmt_bind_param($statement, "sisi", $namaKepalaKeluarga, $jumlahKk, $alamat, $id);
try {
if (mysqli_stmt_execute($statement)) {
echo 'success';
} else {
http_response_code(500);
echo 'error';
}
} catch (mysqli_sql_exception $exception) {
http_response_code(500);
echo 'error: ' . $exception->getMessage();
}
mysqli_stmt_close($statement);
?>