www/includes/db_product.php

changeset 159
6428dae0605d
parent 151
2c9cfe2f0860
child 163
4a4cc3497a57
--- a/www/includes/db_product.php	Sun Dec 30 22:01:27 2018 +0100
+++ b/www/includes/db_product.php	Mon Dec 31 14:41:08 2018 +0100
@@ -203,12 +203,13 @@
 	$sql .= "', sparge_temp='" . $_POST['sparge_temp'];
 	$sql .= "', sparge_ph='" . $_POST['sparge_ph'];
 	$sql .= "', sparge_volume='" . $_POST['sparge_volume'];
-//	$sql .= "', sparge_acid_type='" . $_POST['sparge_acid_type'];
-//	$sql .= "', sparge_acid_perc='" . $_POST['sparge_acid_perc'];
-//	$sql .= "', sparge_acid_amount='" . $_POST['sparge_acid_amount'];
+	$sql .= "', sparge_source='" . $_POST['sparge_source'];
+	$sql .= "', sparge_acid_type='" . $_POST['sparge_acid_type'];
+	$sql .= "', sparge_acid_perc='" . $_POST['sparge_acid_perc'];
+	$sql .= "', sparge_acid_amount='" . $_POST['sparge_acid_amount'];
 	$sql .= "', mash_ph='" . $_POST['mash_ph'];
 	$sql .= "', mash_name='" . $_POST['mash_name'];
-	$sql .= "', calc_acid='" . $_POST['calc_acid'];
+	($_POST['calc_acid'] == 'true') ? $sql .= "', calc_acid='1" : $sql .= "', calc_acid='0";
 	if (isset($_POST['w1_name'])) {
 		$sql .= "', w1_name='" . mysqli_real_escape_string($connect, $_POST['w1_name']);
 		$sql .= "', w1_amount='" . $_POST['w1_amount'];
@@ -297,21 +298,18 @@
 		$sql .= "' WHERE record='" . $_POST['record'] . "';";
 	}
 
-
-//	$result = mysqli_query($connect, $sql);
-//	if (! $result) {
-	//		syslog(LOG_NOTICE, "db_product: result: ".mysqli_error($connect));
-	//		echo $result;
-	//		return;
-//	} else {
-//		if (isset($_POST['update'])) {
-//			syslog(LOG_NOTICE, "db_product: updated record ".$_POST['record']);
-//		} else {
-//			$lastid = mysqli_insert_id($connect);
-//			syslog(LOG_NOTICE, "db_product: inserted record ".$lastid);
-//		}
-//	}
-//	echo $result;
+	$result = mysqli_query($connect, $sql);
+	if (! $result) {
+			syslog(LOG_NOTICE, "db_product: result: ".mysqli_error($connect));
+	} else {
+		if (isset($_POST['update'])) {
+			syslog(LOG_NOTICE, "db_product: updated record ".$_POST['record']);
+		} else {
+			$lastid = mysqli_insert_id($connect);
+			syslog(LOG_NOTICE, "db_product: inserted record ".$lastid);
+		}
+	}
+	echo $result;
 
 } else if (isset($_POST['delete'])) {
 	/*
@@ -494,7 +492,8 @@
 		$brew .= '","sparge_temp":' . floatval($row['sparge_temp']);
 		$brew .= ',"sparge_ph":' . floatval($row['sparge_ph']);
 		$brew .= ',"sparge_volume":' . floatval($row['sparge_volume']);
-		$brew .= ',"sparge_acid_type":"' . $row['sparge_acid_type'];
+		$brew .= ',"sparge_source":"' . $row['sparge_source'];
+		$brew .= '","sparge_acid_type":"' . $row['sparge_acid_type'];
 		$brew .= '","sparge_acid_perc":' . floatval($row['sparge_acid_perc']);
 		$brew .= ',"sparge_acid_amount":' . floatval($row['sparge_acid_amount']);
 		$brew .= ',"mash_ph":' . $row['mash_ph'];

mercurial