| Server IP : 104.21.37.246 / Your IP : 104.23.243.33 [ Web Server : Apache System : Linux cpanel01wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.59.el6.x86_64 #1 SMP Thu Dec 6 05:11:00 EST 2018 x86_64 User : cp648411 ( 1354) PHP Version : 7.2.34 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home2/cp648411/public_html/ilawasia.onnud20.com/z/Events/ |
Upload File : |
<?php
require_once "../config/db.php";
$caseTypeId = $_POST['CaseTypeId'] ?? 0;
$eventId = $_POST['EventId'] ?? 0;
$status = $_POST['Status'] ?? 0;
if ($caseTypeId == 0 || $eventId == 0) {
exit("Invalid Parameter");
}
if ($status == 1) {
// ✔ เพิ่ม mapping
$sql = "
INSERT IGNORE INTO ct_master_case_type_event (CaseTypeId, EventId)
VALUES (?, ?)
";
$stmt = $con->prepare($sql);
$stmt->bind_param("ii", $caseTypeId, $eventId);
$stmt->execute();
echo "Added";
} else {
// ✔ ลบ mapping
$sql = "
DELETE FROM ct_master_case_type_event
WHERE CaseTypeId = ? AND EventId = ?
";
$stmt = $con->prepare($sql);
$stmt->bind_param("ii", $caseTypeId, $eventId);
$stmt->execute();
echo "Removed";
}