pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jerry <admin@paransolutions.com.au>
To: pgsql-php@postgresql.org
Subject: Retrieve a list of databases using PHP
Date: Tue, 05 Apr 2005 21:13:46 +0000
Message-ID: <1112735626.7312.13.camel@localhost.localdomain> (raw)

Try 
SELECT datname FROM pg_database

eg:

<?
$db="template1";
$db_connect=pg_connect("host=192.168.101.1 user=postgres port=5432
dbname=$db");
$db_query="SELECT datname FROM pg_database";
$db_result=pg_exec($db_connect, $db_query);
$db_numrows=pg_numrows($db_result);

//display results

for ($i=0; $i<$db_numrows; $i++)
    {
        $pg_data=pg_fetch_row($db_result, $i);
            printf("$pg_data[0]\n");
                }
                ?>

                      admin@paransolutions.com.au

Message-ID: <1112735626.7312.13.camel@localhost.localdomain>
Permalink:  ../1112735626.7312.13.camel@localhost.localdomain/
Also on:    postgresql.org/message-id/1112735626.7312.13.camel@localhost.localdomain

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: admin@paransolutions.com.au
  Subject: Re: Retrieve a list of databases using PHP
  In-Reply-To: <1112735626.7312.13.camel@localhost.localdomain>
  References: <1112735626.7312.13.camel@localhost.localdomain>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox