<?php
include 'conn.php';

session_start();
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);

$_SESSION['database'] = $_POST['database'];

$montoesql = "SELECT SELECT CONCAT('21',LPAD((cod_client_valor + 1),8,0)) AS cValue FROM " . $_SESSION['database'] . ".empresas WHERE emp_id=1 LIMIT 1";

$qur = $connection->query($montoesql);
$msg = array("cValue" => "0");
while ($r = mysqli_fetch_assoc($qur)) {
    $msg = array("cValue" => $r['cValue']);
}
$jsonData[] = $msg;

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

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