1 <?php |
1 <?php |
2 require_once('config.php'); |
2 require_once('config.php'); |
3 |
3 |
4 $query = "SELECT * FROM inventory_yeasts ORDER BY laboratory,product_id,name"; |
4 $query = "SELECT record,name,type,form,laboratory,product_id,min_temperature,max_temperature,flocculation,attenuation,cells,inventory,cost,tolerance,sta1,bacteria,harvest_top,harvest_time,pitch_temperature,pofpos,zymocide,gr_hl_lo,sg_lo,gr_hl_hi,sg_hi FROM inventory_yeasts ORDER BY laboratory,product_id,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 $yeasts[] = array( |
13 $yeasts[] = $row; |
14 'record' => $row['record'], |
|
15 'name' => $row['name'], |
|
16 'type' => $row['type'], |
|
17 'form' => $row['form'], |
|
18 'laboratory' => $row['laboratory'], |
|
19 'product_id' => $row['product_id'], |
|
20 'min_temperature' => $row['min_temperature'], |
|
21 'max_temperature' => $row['max_temperature'], |
|
22 'flocculation' => $row['flocculation'], |
|
23 'attenuation' => $row['attenuation'], |
|
24 'cells' => $row['cells'], |
|
25 'inventory' => $row['inventory'], |
|
26 'cost' => $row['cost'], |
|
27 'tolerance' => $row['tolerance'], |
|
28 'sta1' => $row['sta1'], |
|
29 'bacteria' => $row['bacteria'], |
|
30 'harvest_top' => $row['harvest_top'], |
|
31 'harvest_time' => $row['harvest_time'], |
|
32 'pitch_temperature' => $row['pitch_temperature'], |
|
33 'pofpos' => $row['pofpos'], |
|
34 'zymocide' => $row['zymocide'], |
|
35 'gr_hl_lo' => $row['gr_hl_lo'], |
|
36 'sg_lo' => $row['sg_lo'], |
|
37 'gr_hl_hi' => $row['gr_hl_hi'], |
|
38 'sg_hi' => $row['sg_hi'] |
|
39 ); |
|
40 } |
14 } |
41 header("Content-type: application/json"); |
15 header("Content-type: application/json"); |
42 echo json_encode($yeasts); |
16 echo json_encode($yeasts); |