23 } |
23 } |
24 if (isset($_POST['update'])) { |
24 if (isset($_POST['update'])) { |
25 $sql = "UPDATE `inventory_yeasts` SET "; |
25 $sql = "UPDATE `inventory_yeasts` SET "; |
26 } |
26 } |
27 |
27 |
28 $sql .= "name='" . mysqli_real_escape_string($connect, $_POST['name']); |
28 if (isset($_POST['uuid']) && (strlen($_POST['uuid']) == 36)) { |
|
29 $sql .= "uuid='" . $_POST['uuid']; |
|
30 } else { |
|
31 $uuid = str_replace("\n", "", file_get_contents('/proc/sys/kernel/random/uuid')); |
|
32 $sql .= "uuid='" . $uuid; |
|
33 } |
|
34 $sql .= "', name='" . mysqli_real_escape_string($connect, $_POST['name']); |
29 $sql .= "', type='" . array_search($_POST['type'], $yeasttype); |
35 $sql .= "', type='" . array_search($_POST['type'], $yeasttype); |
30 $sql .= "', form='" . array_search($_POST['form'], $yeastform); |
36 $sql .= "', form='" . array_search($_POST['form'], $yeastform); |
31 $sql .= "', laboratory='" . mysqli_real_escape_string($connect, $_POST['laboratory']); |
37 $sql .= "', laboratory='" . mysqli_real_escape_string($connect, $_POST['laboratory']); |
32 $sql .= "', product_id='" . mysqli_real_escape_string($connect, $_POST['product_id']); |
38 $sql .= "', product_id='" . mysqli_real_escape_string($connect, $_POST['product_id']); |
33 $sql .= "', short_desc='" . mysqli_real_escape_string($connect, $_POST['short_desc']); |
39 $sql .= "', short_desc='" . mysqli_real_escape_string($connect, $_POST['short_desc']); |
92 $result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect)); |
98 $result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect)); |
93 while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { |
99 while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { |
94 $yeasts[] = array( |
100 $yeasts[] = array( |
95 'record' => $row['record'], |
101 'record' => $row['record'], |
96 'name' => $row['name'], |
102 'name' => $row['name'], |
|
103 'uuid' => $row['uuid'], |
97 'type' => $yeasttype[$row['type']], |
104 'type' => $yeasttype[$row['type']], |
98 'form' => $yeastform[$row['form']], |
105 'form' => $yeastform[$row['form']], |
99 'laboratory' => $row['laboratory'], |
106 'laboratory' => $row['laboratory'], |
100 'product_id' => $row['product_id'], |
107 'product_id' => $row['product_id'], |
101 'short_desc' => $row['short_desc'], |
108 'short_desc' => $row['short_desc'], |