www/getbrewlog.php

Sun, 02 Jun 2019 12:48:54 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 02 Jun 2019 12:48:54 +0200
changeset 392
544d7d0183b2
parent 297
5e2424bfbc4a
permissions
-rw-r--r--

Added 15 fields to the recipes table. Added 18 fields to the products table. These are calculated values that are now stored in the database so export programs can use these values without calculating them again. Product and recipe print have water and mash schedule added. Product print has brewday results added if the brewday is over. The ingredients layout changed in the product and recipe prints.

<?php

require_once('config.php');

if (isset($_GET["code"]))
	$code = $_GET["code"];
else
	$code = "CB0011";

$connect = mysqli_connect(DBASE_HOST, DBASE_USER, DBASE_PASS, DBASE_NAME);
if (! $connect) {
	die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
}
mysqli_set_charset($connect, "utf8" );

$query = "SELECT * FROM log_brews WHERE code='".$code."' ORDER BY datetime;";
$result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect));
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
	$lines[] = array(
		'record' => $row['record'],
		'date' => substr($row['datetime'],0,16),
		'version' => $row['version'],
		'code' => $row['code'],
		'name' => $row['name'],
		'pv_mlt' => $row['pv_mlt'],
		'pv_hlt' => $row['pv_hlt'],
		'pv_room' => $row['pv_room'],
		'sp_mlt' => $row['sp_mlt'],
		'sp_hlt' => $row['sp_hlt'],
		'pwm_mlt' => $row['pwm_mlt'],
		'pwm_hlt' => $row['pwm_hlt'],
		'event' => $row['event']
	);
}
header("Content-type: application/json");
echo json_encode($lines);

mercurial