initial commit
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
require_once "../config/config.php";
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
|
||||
try {
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') throw new RuntimeException('Method not allowed');
|
||||
$id = (int)($_POST['id'] ?? 0);
|
||||
if ($id <= 0) throw new RuntimeException('id fehlt');
|
||||
|
||||
$stmt = $pdo->prepare("DELETE FROM finance_expenses WHERE id=:id");
|
||||
$stmt->execute([':id'=>$id]);
|
||||
|
||||
echo json_encode(['ok'=>true], JSON_UNESCAPED_UNICODE);
|
||||
} catch (Throwable $e) {
|
||||
http_response_code(400);
|
||||
echo json_encode(['ok'=>false,'error'=>$e->getMessage()]);
|
||||
}
|
||||
Reference in New Issue
Block a user