www/getmiscsources.php

Wed, 06 Dec 2023 20:26:00 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 06 Dec 2023 20:26:00 +0100
changeset 855
2d328a2a4025
parent 771
9856238e9217
permissions
-rw-r--r--

Fixed init scripts names in Makefile. Update crontasks to use the database to check the log entries for products.

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
771
9856238e9217 More efficient code for get*sources.php form dropdown lists.
Michiel Broek <mbroek@mbse.eu>
parents: 705
diff changeset
4 $query = "SELECT record,name,type,use_use,time,amount_is_weight,inventory,cost FROM inventory_miscs ORDER BY name";
60
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 }
705
d77b723f7b35 Make sure enumerated values are not empty in database updates. On several data queries set the database connection to UTF-8.
Michiel Broek <mbroek@mbse.eu>
parents: 296
diff changeset
10 mysqli_set_charset($connect, "utf8");
60
dbbe408108ea Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 $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
12 while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
771
9856238e9217 More efficient code for get*sources.php form dropdown lists.
Michiel Broek <mbroek@mbse.eu>
parents: 705
diff changeset
13 $miscs[] = $row;
60
dbbe408108ea Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 }
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
15 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
16 echo json_encode($miscs);

mercurial