forked from edlcn/cs306db
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuys_d.php
More file actions
43 lines (30 loc) · 972 Bytes
/
buys_d.php
File metadata and controls
43 lines (30 loc) · 972 Bytes
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
<?php
include "config.php";
if (!empty($_GET["ids"])){
$code = $_GET["ids"];
$sql_comment = "DELETE FROM buys WHERE code = '".$code."' ";
if (!empty($_GET["pids"])){
$pid = $_GET["pids"];
$sql_comment .= " AND p_id = '".$pid."' ";
$myresult = mysqli_query($db,$sql_comment);
echo "The relationship between Medicine $code AND Patient $pid is deleted.";
}
else {
$myresult = mysqli_query($db,$sql_comment);
echo "All buy relations of Medicine with code: $code is deleted.";
}
}
else {
$sql_comment = "DELETE FROM buys";
if (!empty($_GET["pids"])){
$pid = $_GET["pids"];
$sql_comment .= " WHERE p_id = '".$pid."' ";
$myresult = mysqli_query($db,$sql_comment);
echo "All relationships of patient with ID: $pid is deleted.";
}
else {
$myresult = mysqli_query($db,$sql_comment);
echo "all buy relations are deleted.";
}
}
?>