Proyecto en colaboración con OPASO

amount.php 1.1KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /* Authors : Carlos C. Corrada-Bravo
  3. David J. Ortiz-Rivera
  4. Organization : Centro de Desarrollo y Consultoria Computacional
  5. Project : OPASO Material Registry
  6. File : extract.php
  7. Description : Extract and insert data from tsv. */
  8. /* Import database connection & display errors */
  9. include_once "config.php";
  10. error_reporting(E_ALL);
  11. ini_set("display_errors",1);
  12. /* Initiate statement */
  13. $amount = $db->stmt_init();
  14. if($amount = $db->prepare("SELECT eid,amount,quantity,total FROM Inventory WHERE amount!='n/a' AND quantity!='n/a' AND total!='n/a'")){
  15. /* execute */
  16. if($amount->execute()){
  17. /* fetch result by rows and generate response to script */
  18. $result = $amount->get_result();
  19. $response = array();
  20. while($mult = $result->fetch_assoc()){
  21. $key = $mult["eid"];
  22. $a = $mult["amount"];
  23. $q = $mult["quantity"];
  24. $t = $mult["total"];
  25. if(floatval($a)*floatval($q) != floatval($t)){
  26. echo $key . '<br>';
  27. //echo floatval($a)*floatval($q) . ' ' . floatval($t) . '<br>';
  28. }
  29. }
  30. }
  31. }
  32. ?>