www/includes/db_product.php

changeset 159
6428dae0605d
parent 151
2c9cfe2f0860
child 163
4a4cc3497a57
equal deleted inserted replaced
158:3b9e4dfb0476 159:6428dae0605d
201 $sql .= "', est_ibu='" . $_POST['est_ibu']; 201 $sql .= "', est_ibu='" . $_POST['est_ibu'];
202 $sql .= "', ibu_method='" . $_POST['ibu_method']; 202 $sql .= "', ibu_method='" . $_POST['ibu_method'];
203 $sql .= "', sparge_temp='" . $_POST['sparge_temp']; 203 $sql .= "', sparge_temp='" . $_POST['sparge_temp'];
204 $sql .= "', sparge_ph='" . $_POST['sparge_ph']; 204 $sql .= "', sparge_ph='" . $_POST['sparge_ph'];
205 $sql .= "', sparge_volume='" . $_POST['sparge_volume']; 205 $sql .= "', sparge_volume='" . $_POST['sparge_volume'];
206 // $sql .= "', sparge_acid_type='" . $_POST['sparge_acid_type']; 206 $sql .= "', sparge_source='" . $_POST['sparge_source'];
207 // $sql .= "', sparge_acid_perc='" . $_POST['sparge_acid_perc']; 207 $sql .= "', sparge_acid_type='" . $_POST['sparge_acid_type'];
208 // $sql .= "', sparge_acid_amount='" . $_POST['sparge_acid_amount']; 208 $sql .= "', sparge_acid_perc='" . $_POST['sparge_acid_perc'];
209 $sql .= "', sparge_acid_amount='" . $_POST['sparge_acid_amount'];
209 $sql .= "', mash_ph='" . $_POST['mash_ph']; 210 $sql .= "', mash_ph='" . $_POST['mash_ph'];
210 $sql .= "', mash_name='" . $_POST['mash_name']; 211 $sql .= "', mash_name='" . $_POST['mash_name'];
211 $sql .= "', calc_acid='" . $_POST['calc_acid']; 212 ($_POST['calc_acid'] == 'true') ? $sql .= "', calc_acid='1" : $sql .= "', calc_acid='0";
212 if (isset($_POST['w1_name'])) { 213 if (isset($_POST['w1_name'])) {
213 $sql .= "', w1_name='" . mysqli_real_escape_string($connect, $_POST['w1_name']); 214 $sql .= "', w1_name='" . mysqli_real_escape_string($connect, $_POST['w1_name']);
214 $sql .= "', w1_amount='" . $_POST['w1_amount']; 215 $sql .= "', w1_amount='" . $_POST['w1_amount'];
215 $sql .= "', w1_calcium='" . $_POST['w1_calcium']; 216 $sql .= "', w1_calcium='" . $_POST['w1_calcium'];
216 $sql .= "', w1_sulfate='" . $_POST['w1_sulfate']; 217 $sql .= "', w1_sulfate='" . $_POST['w1_sulfate'];
295 } 296 }
296 if (isset($_POST['update'])) { 297 if (isset($_POST['update'])) {
297 $sql .= "' WHERE record='" . $_POST['record'] . "';"; 298 $sql .= "' WHERE record='" . $_POST['record'] . "';";
298 } 299 }
299 300
300 301 $result = mysqli_query($connect, $sql);
301 // $result = mysqli_query($connect, $sql); 302 if (! $result) {
302 // if (! $result) { 303 syslog(LOG_NOTICE, "db_product: result: ".mysqli_error($connect));
303 // syslog(LOG_NOTICE, "db_product: result: ".mysqli_error($connect)); 304 } else {
304 // echo $result; 305 if (isset($_POST['update'])) {
305 // return; 306 syslog(LOG_NOTICE, "db_product: updated record ".$_POST['record']);
306 // } else { 307 } else {
307 // if (isset($_POST['update'])) { 308 $lastid = mysqli_insert_id($connect);
308 // syslog(LOG_NOTICE, "db_product: updated record ".$_POST['record']); 309 syslog(LOG_NOTICE, "db_product: inserted record ".$lastid);
309 // } else { 310 }
310 // $lastid = mysqli_insert_id($connect); 311 }
311 // syslog(LOG_NOTICE, "db_product: inserted record ".$lastid); 312 echo $result;
312 // }
313 // }
314 // echo $result;
315 313
316 } else if (isset($_POST['delete'])) { 314 } else if (isset($_POST['delete'])) {
317 /* 315 /*
318 * DELETE command. 316 * DELETE command.
319 */ 317 */
492 $brew .= '","est_ibu":' . floatval($row['est_ibu']); 490 $brew .= '","est_ibu":' . floatval($row['est_ibu']);
493 $brew .= ',"ibu_method":"' . $row['ibu_method']; 491 $brew .= ',"ibu_method":"' . $row['ibu_method'];
494 $brew .= '","sparge_temp":' . floatval($row['sparge_temp']); 492 $brew .= '","sparge_temp":' . floatval($row['sparge_temp']);
495 $brew .= ',"sparge_ph":' . floatval($row['sparge_ph']); 493 $brew .= ',"sparge_ph":' . floatval($row['sparge_ph']);
496 $brew .= ',"sparge_volume":' . floatval($row['sparge_volume']); 494 $brew .= ',"sparge_volume":' . floatval($row['sparge_volume']);
497 $brew .= ',"sparge_acid_type":"' . $row['sparge_acid_type']; 495 $brew .= ',"sparge_source":"' . $row['sparge_source'];
496 $brew .= '","sparge_acid_type":"' . $row['sparge_acid_type'];
498 $brew .= '","sparge_acid_perc":' . floatval($row['sparge_acid_perc']); 497 $brew .= '","sparge_acid_perc":' . floatval($row['sparge_acid_perc']);
499 $brew .= ',"sparge_acid_amount":' . floatval($row['sparge_acid_amount']); 498 $brew .= ',"sparge_acid_amount":' . floatval($row['sparge_acid_amount']);
500 $brew .= ',"mash_ph":' . $row['mash_ph']; 499 $brew .= ',"mash_ph":' . $row['mash_ph'];
501 $brew .= ',"mash_name":"' . $row['mash_name']; 500 $brew .= ',"mash_name":"' . $row['mash_name'];
502 $brew .= '","calc_acid":' . $row['calc_acid']; 501 $brew .= '","calc_acid":' . $row['calc_acid'];

mercurial