www/getbrewlog.php

Sun, 23 May 2021 16:41:35 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 23 May 2021 16:41:35 +0200
changeset 752
f68e3bbc1ada
parent 297
5e2424bfbc4a
permissions
-rw-r--r--

Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.

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