1 <?php |
1 <?php |
2 require_once('config.php'); |
2 require_once('config.php'); |
3 |
3 |
4 $query = "SELECT * FROM inventory_miscs ORDER BY name"; |
4 $query = "SELECT record,name,type,use_use,time,amount_is_weight,inventory,cost FROM inventory_miscs ORDER BY name"; |
5 $connect = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME); |
5 $connect = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME); |
6 if (! $connect) { |
6 if (! $connect) { |
7 echo "[]"; |
7 echo "[]"; |
8 return; |
8 return; |
9 } |
9 } |
10 mysqli_set_charset($connect, "utf8"); |
10 mysqli_set_charset($connect, "utf8"); |
11 $result = mysqli_query($connect, $query); |
11 $result = mysqli_query($connect, $query); |
12 while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { |
12 while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { |
13 $miscs[] = array( |
13 $miscs[] = $row; |
14 'record' => $row['record'], |
|
15 'name' => $row['name'], |
|
16 'type' => $row['type'], |
|
17 'use_use' => $row['use_use'], |
|
18 'time' => $row['time'], |
|
19 'amount_is_weight' => $row['amount_is_weight'], |
|
20 'inventory' => $row['inventory'], |
|
21 'cost' => $row['cost'] |
|
22 ); |
|
23 } |
14 } |
24 header("Content-type: application/json"); |
15 header("Content-type: application/json"); |
25 echo json_encode($miscs); |
16 echo json_encode($miscs); |