-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin_update_event.php
39 lines (32 loc) · 993 Bytes
/
admin_update_event.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
<?php
include 'connect.php';
header('Content-type: application/json');
date_default_timezone_set("Asia/Bangkok");
// FILE UNTUK HANDLE UPDATE EVENT
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Ambil info dari Ajax
$id_event = $_POST['id'];
$nama = $_POST['nama'];
$jenis = $_POST['jenis'];
$tempat = $_POST['tempat'];
$link = $_POST['link'];
$updatedAt = date("Y-m-d H:i:s");
$updatedBy = $_SESSION['email'];
// SQL untuk Update Event
$sql = "UPDATE event
SET nama = ?,
jenis = ?,
tempat = ?,
link = ?,
updatedAt = ?,
updatedBy = ?
WHERE id = ?";
$stmt = $pdo->prepare($sql);
$stmt->execute([$nama, $jenis, $tempat, $link, $updatedAt, $updatedBy, $id_event]);
$notif = '';
if ($stmt) {
$notif = 'Updated Successfuly';
}
$output = '';
echo json_encode(array('output' => $output, 'notif' => $notif));
}