fork download
  1. <?php
  2.  
  3. include_once("config.php");
  4.  
  5. $viagemid = $_POST['id'];
  6. $results_array = array();
  7.  
  8. $sql = <<<SQL
  9. SELECT
  10. (SELECT adiantamento FROM viagem WHERE viagemid = {$viagemid}) AS 'Antecipado',
  11. (SELECT SUM(vl_desp) FROM despesas WHERE viagemid = {$viagemid}) AS 'Despesas',
  12. (SELECT SUM(venda.vl_venda * venda.qtd) FROM venda WHERE venda.viagemid = {$viagemid} AND venda.ufid = 1) AS 'Venda SP',
  13. (SELECT SUM(venda.vl_venda * venda.qtd) FROM venda WHERE venda.viagemid = {$viagemid} AND venda.ufid = 2) AS 'Venda local'
  14. SQL;
  15.  
  16. $query = $mysqli->query($sql);
  17. $result = $query->fetch_all(MYSQLI_ASSOC);
  18.  
  19. // $json = '[{"Antecipado":"30000"},{"Despesas":"18256.61"},{"Venda SP":"13080"},{"Venda local":"18021.5"}]';
  20.  
  21.  
  22. ?>
Runtime error #stdin #stdout #stderr 0s 82880KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Warning:  include_once(config.php): failed to open stream: No such file or directory in /home/y29SgL/prog.php on line 3
PHP Warning:  include_once(): Failed opening 'config.php' for inclusion (include_path='.:/usr/share/php') in /home/y29SgL/prog.php on line 3
PHP Notice:  Undefined index: id in /home/y29SgL/prog.php on line 5
PHP Notice:  Undefined variable: mysqli in /home/y29SgL/prog.php on line 16
PHP Fatal error:  Uncaught Error: Call to a member function query() on null in /home/y29SgL/prog.php:16
Stack trace:
#0 {main}
  thrown in /home/y29SgL/prog.php on line 16