-
Notifications
You must be signed in to change notification settings - Fork 0
/
databaseFunctions.php
46 lines (41 loc) · 1.21 KB
/
databaseFunctions.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
46
<?php
//Select Queries
function selectToDoList(){
$sqlQuery = "SELECT * FROM todolist WHERE isComplete= 0;";
return $sqlQuery;
}
function selectToDoListItem($id){
$sqlQuery = "SELECT * FROM todolist WHERE ToDoID = $id;";
return $sqlQuery;
}
//Insert Queries
function createToDoListItem(){
$sqlQuery = "INSERT INTO todolist (ToDoName, ToDoDescription, ToDoDueDate, ToDoCreateDate, isComplete)
VALUES (:todoname,:tododescription, :tododueduate, :todocreatedate, 0);";
return $sqlQuery;
}
//Update Queries
function updateToDoListItem($todoid){
$sqlQuery = "UPDATE todolist SET isComplete = 1
WHERE ToDoID = '$todoid'";
return $sqlQuery;
}
function makeAllTasksIncomplete(){
$sqlQuery = "UPDATE todolist SET isComplete = 0";
return $sqlQuery;
}
function makeAllTasksComplete(){
$sqlQuery = "UPDATE todolist SET isComplete = 1";
return $sqlQuery;
}
function editTaskItem($id){
$sqlQuery = "UPDATE todolist SET ToDoName = :name, ToDoDescription = :description,
ToDoDueDate = :date; WHERE ToDoID = $id;";
return $sqlQuery;
}
//Delete Queries
function deleteTaskItem($item){
$sqlQuery = "DELETE FROM todolist WHERE ToDoId = '$item';";
return $sqlQuery;
}
?>