-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.php
30 lines (22 loc) · 855 Bytes
/
list.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
<?php
include "DBGateway.php";
$request = filter_input_array(INPUT_GET); // http://www.henzard.co.za/list.php?type=me&action=done
$conn = new DB();
//$conn->UpdateRecord("Items", ["Product Desc" => "Crab Apples"], ["ID" => 1]);
//echo "<pre>" . print_r($conn->ReadRecords("Items", ["Isle" => 3]), TRUE) . "</pre>";
switch ($request["action"]) {
case "Create":
echo json_encode($conn->CreateRecord($request["table"], json_decode($request["data"])));
break;
case "Read":
echo json_encode($conn->ReadRecords($request["table"], json_decode($request["where"])));
break;
case "Update":
echo json_encode($conn->UpdateRecord($request["table"], json_decode($request["data"]), json_decode($request["where"])));
break;
case "Delete":
break;
default:
echo json_encode(["error" => "No Action Selected"]);
break;
}