www/includes/db_inventory_equipments.php

changeset 767
08c0343b622b
parent 766
86289b0c4a27
child 785
aa79acfdf8a9
equal deleted inserted replaced
766:86289b0c4a27 767:08c0343b622b
55 } 55 }
56 $result = mysqli_query($connect, $sql); 56 $result = mysqli_query($connect, $sql);
57 if (! $result) { 57 if (! $result) {
58 syslog(LOG_NOTICE, "db_inventory_equipment: ".$sql." result: ".mysqli_error($connect)); 58 syslog(LOG_NOTICE, "db_inventory_equipment: ".$sql." result: ".mysqli_error($connect));
59 $response['error'] = true; 59 $response['error'] = true;
60 $response['msg'] = "SQL fout: ".mysqli_error($link); 60 $response['msg'] = "SQL fout: ".mysqli_error($connect);
61 } 61 }
62 exit(json_encode($response)); 62 exit(json_encode($response));
63 63
64 } else if (isset($_POST['delete'])) { 64 } else if (isset($_POST['delete'])) {
65 // DELETE COMMAND. check if this record is in use. 65 // DELETE COMMAND. check if this record is in use.
66 $sql = "SELECT name FROM `inventory_equipments` WHERE record='".$_POST['record']."';"; 66 $sql = "SELECT name FROM `inventory_equipments` WHERE record='".$_POST['record']."';";
67 $result = mysqli_query($connect, $sql) or die("SQL Error 1: " . mysqli_error($connect)); 67 $result = mysqli_query($connect, $sql) or die("SQL Error 1: " . mysqli_error($connect));
68 if (! $result) { 68 if (! $result) {
69 syslog(LOG_NOTICE, "db_inventory_equipment: ".$sql." result: ".mysqli_error($connect)); 69 syslog(LOG_NOTICE, "db_inventory_equipment: ".$sql." result: ".mysqli_error($connect));
70 $response['error'] = true; 70 $response['error'] = true;
71 $response['msg'] = "SQL fout: ".mysqli_error($link); 71 $response['msg'] = "SQL fout: ".mysqli_error($connect);
72 exit(json_encode($response)); 72 exit(json_encode($response));
73 } 73 }
74 if ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { 74 if ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
75 $sql = "SELECT eq_name FROM products WHERE eq_name='" . $row['name'] . "';"; 75 $sql = "SELECT eq_name FROM products WHERE eq_name='" . $row['name'] . "';";
76 $result2 = mysqli_query($connect, $sql); 76 $result2 = mysqli_query($connect, $sql);
85 $sql = "DELETE FROM `inventory_equipments` WHERE record='".$_POST['record']."';"; 85 $sql = "DELETE FROM `inventory_equipments` WHERE record='".$_POST['record']."';";
86 $result = mysqli_query($connect, $sql); 86 $result = mysqli_query($connect, $sql);
87 if (! $result) { 87 if (! $result) {
88 syslog(LOG_NOTICE, "db_inventory_equipment: ".$sql." result: ".mysqli_error($connect)); 88 syslog(LOG_NOTICE, "db_inventory_equipment: ".$sql." result: ".mysqli_error($connect));
89 $response['error'] = true; 89 $response['error'] = true;
90 $response['msg'] = "SQL fout: ".mysqli_error($link); 90 $response['msg'] = "SQL fout: ".mysqli_error($connect);
91 } 91 }
92 exit(json_encode($response)); 92 exit(json_encode($response));
93 93
94 } else { 94 } else {
95 // SELECT COMMAND 95 // SELECT COMMAND

mercurial