$server = "localhost";
$puerto = "5432";
$database = "nodomarzammanta";
$usuario = "Administrador";
$clave = "ANAHI_ATHINA1233";
// CREA LA CONEXION A POSTGRESQL
$connection = pg_connect("host=$server port=$puerto dbname=$database user=$usuario password=$clave");
//$connection = pg_connect("host=localhost dbname=nodomarzammanta user=Administrador password=ANAHI_ATHINA1233");
// SI EXISTE ALGUN ERROR LO IMPRIME
if (!$connection)
{
print("");
exit;
}
else
{
print("");
}
// declare my query and execute
$myresult = pg_exec($connection, "select * from departamento");
$rows = pg_NumRows($myresult);
// Presenta la informacion almacenada en $resultado_set
for ($j=0; $j < $rows; $j++)
{
echo "ID_DEP :".pg_result($myresult, $j, 0)."
DESC_DEP :".pg_result($myresult, $j, 1)."
EMPR_ID :".pg_result($myresult, $j, 2)."
";
}
/* Cierra la conexion con la base de datos */
pg_close($connection);
?>