<?php
include 'conn.php';
//Select data from database
error_reporting(E_ERROR | E_PARSE);

include 'funciones.php';

session_start();

$_SESSION['database'] = $_GET['dbname'];

$montoesql = "select ifnull(rec_prod,0) as rec_prod,ifnull(rec_pers,0) as rec_pers,ifnull(send_vent,0) as send_vent,ifnull(send_cierres,0) as send_cierres,ifnull(exec_verop,0) as exec_verop from " . $_SESSION['database'] . ".sucursales where  suc_id=1 ";

logs($montoesql);

$qur = $connection->query($montoesql);

while ($r = mysqli_fetch_assoc($qur)) {

    $msg = array("rec_prod" => $r['rec_prod'], "rec_pers" => $r['rec_pers'], "send_vent" => $r['send_vent']);
}

$json = $msg;

// $json = (object)$msg;

header('content-type: application/json');
echo json_encode($json);

$qur=null;
@mysqli_close($connection);
?>
