-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEvent-Reservation-Step2-Insert.php
More file actions
35 lines (34 loc) · 1.14 KB
/
Event-Reservation-Step2-Insert.php
File metadata and controls
35 lines (34 loc) · 1.14 KB
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
<?php
include ('Connection.php');
session_start();
$sqlSelect = "SELECT * FROM `physicalfaci-dept` WHERE `Request` = '".$_POST["sector"]."' and ap_reservation_main_ID = '".$_POST["id"]."'";
$result = mysqli_query($conn, $sqlSelect);
if(mysqli_num_rows($result) > 0 )
{
$sqlUpdate = "UPDATE `physicalfaci-dept` SET `Rate`='".$_POST["payment"]."',`Date`='".$_POST["date"]."',`physical_start`='".$_POST["start"]."',`physical_end`='".$_POST["end"]."',`Pcs`='".$_POST["pcs"]."',`users_ID`='".$_SESSION["User"]."'
where Request = '".$_POST["sector"]."' AND ap_reservation_main_ID = '".$_POST["id"]."'";
if(mysqli_query($conn, $sqlUpdate))
{
echo "Data Updated";
}
else
{
echo "Data not Updated";
}
}
else
{
$sql2 = "INSERT INTO `physicalfaci-dept`
(`ID`, `Rate`, `Date`, `physical_start`, `physical_end`, `Pcs`, `Request`, `users_ID`, `ap_reservation_main_ID`)
VALUES (null,'".$_POST["payment"]."','".$_POST["date"]."','".$_POST["start"]."','".$_POST["end"]."','".$_POST["pcs"]."',
'".$_POST["sector"]."','".$_SESSION["User"]."','".$_POST["id"]."')";
if(mysqli_query($conn, $sql2))
{
echo "Data Added";
}
else
{
echo "Data not added";
}
}
?>