<?php
session_start();
include 'config.php';
	
$sql = "SELECT ID FROM CAMBIE_ID_TRANSFERENCIAWEB";

try {
	$dbh = new PDO("firebird:dbname=$dbname", $_SESSION['usuario'], $_SESSION['clave']);	
	$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
	$stmt = $dbh->prepare($sql);
	$stmt->execute();
	$IDP = $stmt->fetchAll(PDO::FETCH_OBJ);
	$dbh = null;
	echo '{"items":'. json_encode($IDP) .'}'; 
} catch(PDOException $e) {
	if ($e->getCode() == 335544472){
		echo '{"error":[{"ERROR":"1","MSJ":"Mal usuario o clave","ERRORCOD":"'.$e->getCode().'"}]}';
	}else if ($e->getCode() == 335544344){
		echo '{"error":[{"ERROR":"2","MSJ":"No se encontro la base de datos","ERRORCOD":"'.$e->getCode().'"}]}';
	}else{
		echo '{"error":[{"ERROR":"3","MSJ":"NO IDENTIFICADO","ERRORCOD":"'.$e->getMessage().'"}]}'; 
	}
	//echo '{"items":[{"IDP":"0"}]}'; 
}


?>