www/includes/db_inventory_equipments.php

changeset 785
aa79acfdf8a9
parent 767
08c0343b622b
child 840
ba607babc468
equal deleted inserted replaced
784:d51b05838ac4 785:aa79acfdf8a9
21 } 21 }
22 if (isset($_POST['update'])) { 22 if (isset($_POST['update'])) {
23 // UPDATE COMMAND 23 // UPDATE COMMAND
24 $sql = "UPDATE `inventory_equipments` SET "; 24 $sql = "UPDATE `inventory_equipments` SET ";
25 } 25 }
26 $sql .= "name='" . mysqli_real_escape_string($connect, $_POST['name']); 26
27 if (isset($_POST['uuid']) && (strlen($_POST['uuid']) == 36)) {
28 $sql .= "uuid='" . $_POST['uuid'];
29 } else {
30 $uuid = str_replace("\n", "", file_get_contents('/proc/sys/kernel/random/uuid'));
31 $sql .= "uuid='" . $uuid;
32 }
33 $sql .= "', name='" . mysqli_real_escape_string($connect, $_POST['name']);
27 $sql .= "', boil_size='" . $_POST['boil_size']; 34 $sql .= "', boil_size='" . $_POST['boil_size'];
28 $sql .= "', batch_size='" . $_POST['batch_size']; 35 $sql .= "', batch_size='" . $_POST['batch_size'];
29 $sql .= "', tun_volume='" . $_POST['tun_volume']; 36 $sql .= "', tun_volume='" . $_POST['tun_volume'];
30 $sql .= "', tun_weight='" . $_POST['tun_weight']; 37 $sql .= "', tun_weight='" . $_POST['tun_weight'];
31 $sql .= "', tun_specific_heat='" . $_POST['tun_specific_heat']; 38 $sql .= "', tun_specific_heat='" . $_POST['tun_specific_heat'];
97 $result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect)); 104 $result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect));
98 while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { 105 while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
99 $equipments[] = array( 106 $equipments[] = array(
100 'record' => $row['record'], 107 'record' => $row['record'],
101 'name' => $row['name'], 108 'name' => $row['name'],
109 'uuid' => $row['uuid'],
102 'boil_size' => $row['boil_size'], 110 'boil_size' => $row['boil_size'],
103 'batch_size' => $row['batch_size'], 111 'batch_size' => $row['batch_size'],
104 'tun_volume' => $row['tun_volume'], 112 'tun_volume' => $row['tun_volume'],
105 'tun_weight' => $row['tun_weight'], 113 'tun_weight' => $row['tun_weight'],
106 'tun_specific_heat' => $row['tun_specific_heat'], 114 'tun_specific_heat' => $row['tun_specific_heat'],

mercurial