-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeleteorder.php
63 lines (50 loc) · 1.18 KB
/
deleteorder.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
include 'connectdb.php';
session_start();
include 'sweet.php';
if(isset($_GET['btn_delete'])){
if($_SESSION['role']=="User"){
echo'<script type="text/javascript">
jQuery(function validation(){
swal({
title: "Only for admin",
text: "NO ACEESS",
icon: "error",
});
});
</script>';
header('refresh:1;orderlist.php');
}
else{
$id = $_GET['btn_delete'];
// echo $id;
if ($id) {
// DELETE T1,T2 FROM T1 INNER JOIN T2 ON T1.key = T2.key WHERE condition T1.key = id;
$sql = "delete tbl_invoice, tbl_invoice_details FROM tbl_invoice INNER JOIN tbl_invoice_details ON tbl_invoice.in_id = tbl_invoice_details.in_id where tbl_invoice.in_id=$id";
$delete = $pdo->prepare($sql);
if($delete->execute()){
echo'<script type="text/javascript">
jQuery(function validation(){
swal({
title: "Succfully Deleted",
text: "DELETE",
icon: "success",
});
});
</script>';
}else{
echo '<script type="text/javascript">
jQuery(function validation(){
swal({
title: "DELETE",
text: "Fail",
icon: "error",
});
});
</script>';
}
}
header("location:orderlist.php");
}
}
?>