24 lines
603 B
PHP
24 lines
603 B
PHP
<?php
|
|
include 'koneksi.php';
|
|
header('Content-Type: application/json');
|
|
|
|
if (!isset($_POST['id_account'])) {
|
|
echo json_encode(["status" => "error", "message" => "Data tidak valid."]);
|
|
exit;
|
|
}
|
|
|
|
$id = $_POST['id_account'];
|
|
|
|
try {
|
|
|
|
$stmt = $pdo->prepare("DELETE FROM account WHERE id_account = ?");
|
|
if ($stmt->execute([$id])) {
|
|
echo json_encode(["status" => "success"]);
|
|
} else {
|
|
echo json_encode(["status" => "error", "message" => "Gagal menghapus data."]);
|
|
}
|
|
} catch (Exception $e) {
|
|
echo json_encode(["status" => "error", "message" => $e->getMessage()]);
|
|
}
|
|
?>
|