-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeleteAccountProcess.php
More file actions
28 lines (24 loc) · 1.18 KB
/
Copy pathdeleteAccountProcess.php
File metadata and controls
28 lines (24 loc) · 1.18 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
<?php
include "connection.php";
session_start();
$role_id = $_SESSION['role_id'];
$user_id = $_GET['user_id'];
if ($role_id == 1) {
$query = "DELETE FROM products WHERE vendor_id = $user_id;";
} else if ($role_id = 2) {
$query = "DELETE FROM bookings WHERE tourist_id = $user_id;";
}
mysqli_query($connect, $query);
if (mysqli_query($connect, $query)) {
$query = "DELETE FROM users WHERE user_id = $user_id;";
if (mysqli_query($connect, $query)) {
echo "<script>alert('Alhamdulillah udah bisa'); window.location.href='logoutSession.php'</script>";
} else {
echo mysqli_error($connect);
//echo "<script>alert('Maaf gabisa nambahin soalnya nganu<br>" . mysqli_error($connect) . "'); window.location.href='homeVendor.php'</script>";
}
} else {
echo mysqli_error($connect);
//echo "<script>alert('Maaf gabisa nambahin soalnya nganu<br>" . mysqli_error($connect) . "'); window.location.href='homeVendor.php'</script>";
}
?>