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

$edcdv = $_POST["edcdv"];
$edctipoid = $_POST["edctipoid"];
$edcnomcli = $_POST["edcnomcli"];
$edcape1 = $_POST["edcape1"];
$edcape2 = $_POST["edcape2"];
$edcnom1 = $_POST["edcnom1"];
$edcnom2 = $_POST["edcnom2"];
$edcdir = $_POST["edcdir"];
$edcciu = $_POST["edcciu"];
$edctel = $_POST["edctel"];
$edcfax = $_POST["edcfax"];
$edccel = $_POST["edccel"];
$edcmail = $_POST["edcmail"];
$edccontacto = $_POST["edccontacto"];
$edcobs = $_POST["edcobs"];

$edcnit = $_POST["edcnit"];
	
$sql = "update terceros set terc_dv = '" . $edcdv . "'," .
		"terc_tipoid = '" . $edctipoid . "'," .
		"terc_nom = '" . $edcnomcli . "'," .
		"terc_apellido1 = '" . $edcape1 . "'," .
		"terc_apellido2 = '" . $edcape2 . "'," .
		"terc_nombre1 = '" . $edcnom1 . "'," .
		"terc_nombre2 = '" . $edcnom2 . "'," .
		"terc_dir = '" . $edcdir . "'," .
		"terc_ciu = '" . $edcciu . "'," .
		"terc_tel = '" . $edctel . "'," .
		"terc_cel = '" . $edccel . "'," .
		"terc_fax = '" . $edcfax . "'," .
		"terc_email = '" . $edcmail . "'," .
		"terc_contacto = '" . $edccontacto . "'," .
		"terc_obs = '" . $edcobs . "' where terc_nit = :NIT";

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", $edcnit);
	$stmt->execute();
	$dbh = null;
//	echo '{"items":'. json_encode($nomc .'}'; 
} catch(PDOException $e) {
	echo '{"error":{"text":'. $e->getMessage() .'}}'; 
}

?>