-
Notifications
You must be signed in to change notification settings - Fork 0
/
Event-Committees-Update.php
39 lines (39 loc) · 1023 Bytes
/
Event-Committees-Update.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 ('Connection.php');
$sqlSelect = "SELECT * FROM `ap_committees` WHERE `Committee` = '".$_POST["committee"]."' and ap_id = '".$_POST["id"]."' group by Committee";
$result = mysqli_query($conn, $sqlSelect);
if(mysqli_num_rows($result) > 0 )
{
while($row = mysqli_fetch_array($result))
{
// IF IT'S DONE, IT WILL TURN INTO NOT DONE
if($row["Committees_Status"] == "Done")
{
$sqlUpdate = "UPDATE `ap_committees` SET `Committees_Status`= 'Not Done'
WHERE `Committee` = '".$_POST["committee"]."' and ap_id = '".$_POST["id"]."'";
if(mysqli_query($conn, $sqlUpdate))
{
echo "Data Updated";
}
else
{
echo "Data not Updated";
}
}
// IF IT'S NOT DONE, IT WILL TURN INTO DONE
else
{
$sqlUpdate = "UPDATE `ap_committees` SET `Committees_Status`= 'Done'
WHERE `Committee` = '".$_POST["committee"]."' and ap_id = '".$_POST["id"]."'";
if(mysqli_query($conn, $sqlUpdate))
{
echo "Data Updated";
}
else
{
echo "Data not Updated";
}
}
}
}
?>