Retrieve a list of databases using PHP
am 05.04.2005 23:13:46 von Jerry--=-m8vcQcyxIr2PM/90tEMh
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
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
--=-m8vcQcyxIr2PM/90tEMh
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit
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");
}
?>
--=-m8vcQcyxIr2PM/90tEMh--