www/getbrewlog.php

Thu, 20 Jun 2019 13:55:12 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 20 Jun 2019 13:55:12 +0200
changeset 419
99a7f2a6976e
parent 297
5e2424bfbc4a
permissions
-rw-r--r--

Added packaging volume and add water or liquer to the beer after fermentation. Auto divide changing volumes between bottles and fusts. Upgrade the database in the crontask. Added these fields to the packaging tab screen.

<?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