<?php
session_start();
include 'config.php';

$nitcli = $_GET["nitcli"];
	
$sql = "select terc_nit, terc_dv, terc_tipoid, terc_nom, terc_apellido1, terc_apellido2, terc_nombre1, terc_nombre2, terc_dir, terc_ciu, terc_tel, terc_cel, terc_fax, terc_email, terc_contacto, terc_obs from TRAE_CLIENTE_MOVIL('". $_GET["nitcli"]. "')";

try {
	$dbh = new PDO("firebird:dbname=$dbname", $_SESSION['usuario'], $_SESSION['clave']);	
	$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
	$stmt = $dbh->prepare($sql);
	$stmt->bindParam("NIT", $nitcli);
	$stmt->execute();
	$nomc = $stmt->fetchAll(PDO::FETCH_OBJ);
	$dbh = null;
	echo '{"items":'. json_encode($nomc) .'}'; 
} catch(PDOException $e) {
	echo '{"items":[{"TERC_NOM":""}]}'; 
}


?>