-
Notifications
You must be signed in to change notification settings - Fork 1
/
delete_gym.php
44 lines (29 loc) · 1.01 KB
/
delete_gym.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
<?php
require('db.php');
$inf=$_GET['id'];
$sql_member="DELETE FROM member WHERE trainer_id=(select trainer_id from trainer where pay_id=(select pay_id from payment where gym_id=(select gym_id from gym where gym_id='$inf')))";
$sql_query_mem=mysqli_query($conn,$sql_member);
if ($sql_query_mem) {
$sql_trainer="DELETE FROM trainer where pay_id=(select pay_id from payment where gym_id=(select gym_id from gym where gym_id='$inf'))";
$sql_query_trainer=mysqli_query($conn,$sql_trainer);
}else{
echo "not delted";
}
if ($sql_query_trainer) {
$sql_payment="DELETE FROM payment WHERE gym_id=(select gym_id from gym where gym_id='$inf')";
$sql_querypayment=mysqli_query($conn,$sql_payment);
}else{
echo "not deleted".mysqli_error($conn);
}
if ($sql_querypayment) {
$sql_query="DELETE FROM gym WHERE gym_id='$inf'";
$delete=mysqli_query($conn,$sql_query);
if ($delete) {
header("location:home.php?info=manage_gym");
}else{
echo "error".mysqli_error($conn);
}
}else{
echo "not delete".mysqli_error($conn);
}
?>