Tue, 07 Jan 2020 15:47:00 +0100
Changed several float precision values. Changed some database fields to double. Everything has now the same precision as received values from the iSpindel.
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | <?php |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | require_once('config.php'); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | $query = "SELECT * FROM inventory_miscs ORDER BY name"; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | $connect = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | if (! $connect) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | echo "[]"; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | return; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | } |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | $result = mysqli_query($connect, $query); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | $miscs[] = array( |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | 'record' => $row['record'], |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | 'name' => $row['name'], |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | 'type' => $row['type'], |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | 'use_use' => $row['use_use'], |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | 'time' => $row['time'], |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | 'amount_is_weight' => $row['amount_is_weight'], |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | 'inventory' => $row['inventory'], |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | 'cost' => $row['cost'] |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | ); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | } |
296
69fadd1aded2
Updated design document. Add content header application/json to all scripts that produce json output. Chart prints show the beer code and name in the header. Charts don't display the menu anymore.
Michiel Broek <mbroek@mbse.eu>
parents:
60
diff
changeset
|
23 | header("Content-type: application/json"); |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | echo json_encode($miscs); |