Sun, 27 Jan 2019 17:39:26 +0100
Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
58
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | <?php |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | require_once('config.php'); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | |
69
ca25fdce3b85
Improved hop selection dropdown
Michiel Broek <mbroek@mbse.eu>
parents:
58
diff
changeset
|
4 | $query = "SELECT * FROM inventory_hops ORDER BY origin,name"; |
58
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | $connect = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | if (! $connect) { |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | echo "[]"; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | return; |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | } |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | $result = mysqli_query($connect, $query); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | $hops[] = array( |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | 'record' => $row['record'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | 'name' => $row['name'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | 'alpha' => $row['alpha'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | 'beta' => $row['beta'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | 'humulene' => $row['humulene'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | 'caryophyllene' => $row['caryophyllene'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | 'cohumulone' => $row['cohumulone'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | 'myrcene' => $row['myrcene'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | 'hsi' => $row['hsi'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | 'total_oil' => $row['total_oil'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | 'useat' => $row['useat'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | 'type' => $row['type'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | 'form' => $row['form'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | 'origin' => $row['origin'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | 'inventory' => $row['inventory'], |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
28 | 'cost' => $row['cost'] |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | ); |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
30 | } |
83ccc36df675
Added hops inline editor framework
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
31 | echo json_encode($hops); |