www/includes/db_product.php

changeset 185
4c25db9e8102
parent 166
635033a29c48
child 192
7f69b43e6084
--- a/www/includes/db_product.php	Wed Jan 09 16:19:26 2019 +0100
+++ b/www/includes/db_product.php	Thu Jan 10 20:22:06 2019 +0100
@@ -335,6 +335,24 @@
 	}
 
 	/*
+	 * SELECT, produce a list of products that can be fermented.
+	 */
+	if (isset($_GET['select']) && ($_GET['select'] == "ferment")) {
+		$query  = "SELECT code,name,stage FROM products WHERE ";
+		$query .= "stage='Wait' OR stage='Brew' OR stage='Primary' OR stage='Secondary' OR stage='Tertiary' OR stage='Carbonation' ORDER BY code;";
+		$result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect));
+		while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
+			$brews[] = array(
+				'code' => $row['code'],
+				'name' => $row['name'],
+				'stage' => $row['stage']
+			);
+		}
+		echo json_encode($brews);
+		return;
+	}
+
+	/*
 	 * Default, select all or a given record.
 	 */
 	if (isset($_GET['record'])) {

mercurial