-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo_action.php
72 lines (63 loc) · 1.88 KB
/
demo_action.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/**
* pje - PHP jquery UI editor
*
* @see https://github.com/coyote333666/pje The pje GitHub project
*
* @author Vincent Fortier <[email protected]>
* @copyright 2023 Vincent Fortier
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @note This program is distributed in the hope that it will be useful - WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*/
require_once('constant.php');
require_once(FILE_FUNCTION);
if(isset($_POST["action"]))
{
if($_POST["action"] == "insert")
{
$queryInsert = "
INSERT INTO test (column_1, column_2, column_3) VALUES ('".$_POST["column_1"]."', '".$_POST["column_2"]."', '".$_POST["column_3"]."')
";
# echo('<pre>' . $queryInsert . '</pre>');
echo '<p>Data Inserted...</p>';
fncQueryPg($queryInsert);
}
if($_POST["action"] == "fetch_single")
{
$queryFetch = "
SELECT * FROM test WHERE id = '".$_POST["id"]."'
";
# echo('<pre>' . $queryFetch . '</pre>');
$result = fncQueryPg($queryFetch);
for($y=0; $y<sizeof($result); $y++)
{
$output['column_1'] = $result[$y]['column_1']['VALUE'];
$output['column_2'] = $result[$y]['column_2']['VALUE'];
$output['column_3'] = $result[$y]['column_3']['VALUE'];
}
echo json_encode($output);
}
if($_POST["action"] == "update")
{
$queryUpdate = "
UPDATE test
SET column_1 = '".$_POST["column_1"]."',
column_2 = '".$_POST["column_2"]."',
column_3 = '".$_POST["column_3"]."'
WHERE id = '".$_POST["hidden_id"]."'
";
# echo('<pre>' . $queryUpdate . '</pre>');
fncQueryPg($queryUpdate);
echo '<p>Data Updated</p>';
}
if($_POST["action"] == "delete")
{
$queryDelete = "DELETE FROM test WHERE id = '".$_POST["id"]."'";
# echo('<pre>' . $queryDelete . '</pre>');
fncQueryPg($queryDelete);
echo '<p>Data Deleted</p>';
}
}
?>