<?php

include "../bd/conecta.inc.php";//palm
include "../bd/funcoes.inc.php";//palm

    
$campo= recebevar("param");
$select = recebevar("sql");

    //"SELECT codcli, upper(razao) as razao from clientes WHERE razao LIKE upper('$campo%') ";
$sql_count = $select ."'". $campo . "%')";
$sql = $sql_count . " rows 1 to 20 ";		
		
//Echo $sql_count ;
//Echo $sql;
$rs_count  = ibase_query( $con, $sql_count );

$rows = ibase_num_rows($rs_count);

$rs = ibase_query( $con, $sql);

while($obj = ibase_fetch_object($rs))
{
	$arr[] = $obj;
}

Echo $_GET['callback'].'({"total":"'.$rows.'","results":'.json_encode($arr).'})'; 

?>
