Updated SQL File to remove dummy data.
This commit is contained in:
12
update_project.php
Normal file
12
update_project.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
$data = json_decode(file_get_contents('php://input'), true);
|
||||
$id = intval($data['id']);
|
||||
$name = trim($data['name']);
|
||||
|
||||
if ($id && $name) {
|
||||
$pdo = new PDO('sqlite:data.db');
|
||||
$stmt = $pdo->prepare('UPDATE projects SET name = ? WHERE id = ?');
|
||||
echo json_encode(['success' => $stmt->execute([$name, $id])]);
|
||||
} else {
|
||||
echo json_encode(['success' => false]);
|
||||
}
|
||||
Reference in New Issue
Block a user