-
Notifications
You must be signed in to change notification settings - Fork 0
/
backend_update.php
45 lines (37 loc) · 1.08 KB
/
backend_update.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
namespace App;
/**
* PHP SQLite Update Demo
*/
class SQLiteUpdate {
/**
* PDO object
* @var \PDO
*/
private $pdo;
/**
* Initialize the object with a specified PDO object
*/
public function __construct($pdo) {
$this->pdo = $pdo;
}
/**
* Mark a task specified by the task_id completed
* @param type $taskId
* @param type $completedDate
* @return bool true if success and falase on failure
*/
public function completeTask($taskId, $completedDate) {
// SQL statement to update status of a task to completed
$sql = "UPDATE tasks "
. "SET completed = 1, "
. "completed_date = :completed_date "
. "WHERE task_id = :task_id";
$stmt = $this->pdo->prepare($sql);
// passing values to the parameters
$stmt->bindValue(':task_id', $taskId);
$stmt->bindValue(':completed_date', $completedDate);
// execute the update statement
return $stmt->execute();
}
}