-
Notifications
You must be signed in to change notification settings - Fork 1
/
editinsert.php
81 lines (56 loc) · 3.61 KB
/
editinsert.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
include('db.php');
$customername = mysqli_real_escape_string($connection, $_REQUEST['customer_name']);
$customeremail = mysqli_real_escape_string($connection, $_REQUEST['customer_email']);
$routingquery = mysqli_real_escape_string($connection, $_REQUEST['cid']);
$identification = mysqli_real_escape_string($connection, $_REQUEST['tid']);
$myticket = mysqli_real_escape_string($connection, $_REQUEST['ticket']);
$inTrack = mysqli_real_escape_string($connection, $_REQUEST['incoming']);
$outTrack = mysqli_real_escape_string($connection, $_REQUEST['outgoing']);
$firstNote = mysqli_real_escape_string($connection, $_REQUEST['note1']);
$secondNote = mysqli_real_escape_string($connection, $_REQUEST['note2']);
$myproducts = mysqli_real_escape_string($connection, $_REQUEST['myproduct']);
$mywarranty = mysqli_real_escape_string($connection, $_REQUEST['mywarranty']);
$mydestination = mysqli_real_escape_string($connection, $_REQUEST['mydestination']);
$quantity = mysqli_real_escape_string($connection, $_REQUEST['myquantity']);
$mypackage = mysqli_real_escape_string($connection, $_REQUEST['mypackage']);
//for removing a checked in item.
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
if ($myproducts != 50) {
mysqli_query($connection, "UPDATE logged_info SET selected_product = $myproducts WHERE tid = $identification");
}
if ($mydestination != 50) {
mysqli_query($connection, "UPDATE logged_info SET location = $mydestination WHERE tid = $identification");
}
if ($quantity != 20) {
mysqli_query($connection, "UPDATE logged_info SET quantity = $quantity WHERE tid = $identification");
}
if ($mywarranty != 3) {
mysqli_query($connection, "UPDATE logged_info SET warranty = $mywarranty WHERE tid = $identification");
}
if ($mypackage != 6) {
mysqli_query($connection, "UPDATE logged_info SET weight = $mypackage WHERE tid = $identification");
}
//Update or insert the changed information
mysqli_query($connection, "UPDATE logged_info SET ticket_number = '$myticket' WHERE tid = $identification");
mysqli_query($connection, "INSERT INTO logged_info (ticket_number) VALUES ('$myticket') WHERE tid = $identification");
//Update or insert the changed information
mysqli_query($connection, "UPDATE logged_info SET incoming_barcode = '$inTrack' WHERE tid = $identification");
mysqli_query($connection, "INSERT INTO logged_info (incoming_barcode) VALUES ('$inTrack') WHERE tid = $identification");
//Update or insert the changed information
mysqli_query($connection, "INSERT INTO logged_info (outgoing_barcode) VALUES ('$outTrack') WHERE tid = $identification");
mysqli_query($connection, "UPDATE logged_info SET outgoing_barcode = '$outTrack' WHERE tid = $identification");
//Update or insert the changed information
mysqli_query($connection, "INSERT INTO logged_info (note) VALUES ('$firstNote') WHERE tid = $identification;");
mysqli_query($connection, "INSERT INTO logged_info (note2) VALUES ('$secondNote') WHERE tid = $identification;");
//Update or insert the changed information
mysqli_query($connection, "UPDATE logged_info SET note = '$firstNote' WHERE tid = $identification");
mysqli_query($connection, "UPDATE logged_info SET note2 = '$secondNote' WHERE tid = $identification");
//update customer name
if ($customername == '') {
}else mysqli_query($connection, "UPDATE customers SET name = '$customername' WHERE cid = $routingquery");
if ($customeremail == '') {
}else mysqli_query($connection, "UPDATE customers SET email = '$customeremail' WHERE cid = $routingquery");
}else mysqli_error($connection);
echo "<META http-equiv='refresh' content='.1;customers.php?cid=" . $routingquery . "'>";
?>