Código PHP:
<?php
$conn = pg_pconnect( "host=intranet port=5432 user=postgres password=xx dbname=textil_sanmiguel" ) or die ("No Hay Comunicacion");
$listado = pg_query( "select descripcion_ubicacion as name, codigo_departamento as id from ubicacion_geografica where codigo_provincia='00' and codigo_distrito='00'" );
while( $item=pg_fetch_assoc($listado)){
$resul[] = $item;
}
pg_free_result($listado);
pg_close($conn);
$obj = new stdClass;
$obj->identifier = "id";
$obj->label = "name";
$obj->items = $resul;
$data = json_encode( $obj );
echo $data;
?>
Código HTML:
<div dojoType="dojo.data.ItemFileReadStore" jsId="stateStore2" url="datos2.php" clearOnClose="true"></div> <input dojoType="dijit.form.ComboBox" store="stateStore2" searchAttr="name" autocomplete="true"/>
Código:
Espero alguna ayuda y/o sugerencia......... Desde ya muchas gracias {"identifier":"id","label":"name","items":[{"name":"AMAZONAS","id":"01"}, {"name":"ANCASH","id":"02"},{"name":"APURIMAC","id":"03"}, {"name":"AREQUIPA","id":"04"},{"name":"AYACUCHO","id":"05"}, {"name":"CAJAMARCA","id":"06"},{"name":"CALLAO","id":"07"}, {"name":"CUSCO","id":"08"},{"name":"HUANCAVELICA","id":"09"}, {"name":"HUANUCO","id":"10"},{"name":"ICA","id":"11"},{"name":"JUNIN","id":" 12"},{"name":"LA LIBERTAD","id":"13"},{"name":"LAMBAYEQUE","id":"14"}, {"name":"LIMA","id":"15"},{"name":"LORETO","id":"16"},{"name":"MADRE DE DIOS","id":"17"},{"name":"MOQUEGUA","id":"18"},{"name":"PASCO","id":"19"}, {"name":"PIURA","id":"20"},{"name":"PUNO","id":"21"},{"name":"SAN MARTIN","id":"22"},{"name":"TACNA","id":"23"},{"name":"TUMBES","id":"24"}, {"name":"UCAYALI","id":"25"}]}