www/includes/db_product.php

changeset 577
b4bfed3684d0
parent 565
dfc850e6ee1f
child 602
10b61aacb1c1
equal deleted inserted replaced
576:8853fd62ac6f 577:b4bfed3684d0
561 echo json_encode($brews, JSON_UNESCAPED_UNICODE); 561 echo json_encode($brews, JSON_UNESCAPED_UNICODE);
562 return; 562 return;
563 } 563 }
564 564
565 if (isset($_GET['select']) && ($_GET['select'] == "archname")) { 565 if (isset($_GET['select']) && ($_GET['select'] == "archname")) {
566 $query = "SELECT record,name,code,brew_date_start,st_name,og,fg,batch_size FROM products WHERE stage = '11' ORDER BY name,brew_date_start;"; 566 $query = "SELECT record,name,code,brew_date_start,st_name,brew_fermenter_sg,fg,batch_size FROM products WHERE stage = '11' ORDER BY name,brew_date_start;";
567 $result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect)); 567 $result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect));
568 while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { 568 while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
569 $brews[] = array( 569 $brews[] = array(
570 'record' => $row['record'], 570 'record' => $row['record'],
571 'name' => $row['name'], 571 'name' => $row['name'],
572 'code' => $row['code'], 572 'code' => $row['code'],
573 'date' => substr($row['brew_date_start'], 0, 10), 573 'date' => substr($row['brew_date_start'], 0, 10),
574 'style' => $row['st_name'], 574 'style' => $row['st_name'],
575 'og' => $row['og'], 575 'og' => $row['brew_fermenter_sg'],
576 'fg' => $row['fg'], 576 'fg' => $row['fg'],
577 'batch_size' => $row['batch_size'] 577 'batch_size' => $row['batch_size']
578 ); 578 );
579 } 579 }
580 header("Content-type: application/json"); 580 header("Content-type: application/json");
581 echo json_encode($brews, JSON_UNESCAPED_UNICODE); 581 echo json_encode($brews, JSON_UNESCAPED_UNICODE);
582 return; 582 return;
583 } 583 }
584 584
585 if (isset($_GET['select']) && ($_GET['select'] == "archcode")) { 585 if (isset($_GET['select']) && ($_GET['select'] == "archcode")) {
586 $query = "SELECT record,name,code,brew_date_start,st_name,og,fg,batch_size FROM products WHERE stage = '11' ORDER BY code;"; 586 $query = "SELECT record,name,code,brew_date_start,st_name,brew_fermenter_sg,fg,batch_size FROM products WHERE stage = '11' ORDER BY code;";
587 $result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect)); 587 $result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect));
588 while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { 588 while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
589 $brews[] = array( 589 $brews[] = array(
590 'record' => $row['record'], 590 'record' => $row['record'],
591 'name' => $row['name'], 591 'name' => $row['name'],
592 'code' => $row['code'], 592 'code' => $row['code'],
593 'date' => substr($row['brew_date_start'], 0, 10), 593 'date' => substr($row['brew_date_start'], 0, 10),
594 'style' => $row['st_name'], 594 'style' => $row['st_name'],
595 'og' => $row['og'], 595 'og' => $row['brew_fermenter_sg'],
596 'fg' => $row['fg'], 596 'fg' => $row['fg'],
597 'batch_size' => $row['batch_size'] 597 'batch_size' => $row['batch_size']
598 ); 598 );
599 } 599 }
600 header("Content-type: application/json"); 600 header("Content-type: application/json");
601 echo json_encode($brews, JSON_UNESCAPED_UNICODE); 601 echo json_encode($brews, JSON_UNESCAPED_UNICODE);
602 return; 602 return;
603 } 603 }
604 604
605 if (isset($_GET['select']) && ($_GET['select'] == "archdate")) { 605 if (isset($_GET['select']) && ($_GET['select'] == "archdate")) {
606 $query = "SELECT record,name,code,brew_date_start,st_name,og,fg,batch_size FROM products WHERE stage = '11' ORDER BY brew_date_start;"; 606 $query = "SELECT record,name,code,brew_date_start,st_name,brew_fermenter_sg,fg,batch_size FROM products WHERE stage = '11' ORDER BY brew_date_start;";
607 $result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect)); 607 $result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect));
608 while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { 608 while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
609 $brews[] = array( 609 $brews[] = array(
610 'record' => $row['record'], 610 'record' => $row['record'],
611 'name' => $row['name'], 611 'name' => $row['name'],
612 'code' => $row['code'], 612 'code' => $row['code'],
613 'year' => substr($row['brew_date_start'], 0, 4), 613 'year' => substr($row['brew_date_start'], 0, 4),
614 'date' => substr($row['brew_date_start'], 0, 10), 614 'date' => substr($row['brew_date_start'], 0, 10),
615 'style' => $row['st_name'], 615 'style' => $row['st_name'],
616 'og' => $row['og'], 616 'og' => $row['brew_fermenter_sg'],
617 'fg' => $row['fg'], 617 'fg' => $row['fg'],
618 'batch_size' => $row['batch_size'] 618 'batch_size' => $row['batch_size']
619 ); 619 );
620 } 620 }
621 header("Content-type: application/json"); 621 header("Content-type: application/json");

mercurial