<?php
include 'conn.php';
error_reporting(E_ERROR | E_PARSE);
session_start();

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

$cSql_Suc =   "SELECT suc_id, suc_codigo, UPPER(TRIM(suc_descripcion)) AS suc_descripcion FROM $cDbName.sucursales WHERE (suc_id<>1) AND (IFNULL(suc_activa,0)=1) ORDER BY 3" ;
$oData = mysqli_query($connection, $cSql_Suc);

$jsonData = array();
$jsonTempData = array();

while($row = mysqli_fetch_array($oData, MYSQLI_ASSOC)){
    $jsonTempData['suc_id']= $row['suc_id'];
    $jsonTempData['suc_descripcion']= utf8_encode($row['suc_descripcion']);
    
    $jsonData[] = $jsonTempData;
}

header('Content-type: application/json');
print_r(json_encode($jsonData));

$row=NULL;
$jsonData=NULL;
$jsonTempData=NULL;

mysqli_free_result($oData);
mysqli_close($connection);
/*
ULTIMA MODICICASION 2022-09-01 JOHNN GUTIERREZ
*/
?>