note 13660 modified in ref.pgsql by yohgaki
| From: | yohgaki@php.net | Date: | Tue, 09 Apr 2002 02:19:14 +0000 |
| Subject: | note 13660 modified in ref.pgsql by yohgaki | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-28989@lists.php.net to get a copy of this message | ||
I've tried to mimic the following mysql database connection functions for postgres.
http://www.php.net/manual/en/function.mysql-list-dbs.php
http://www.php.net/manual/en/function.mysql-list-tables.php
These are assuming that you're passing in $link as the result from pg_connect:
function pg_list_dbs($link)
{
$sql = 'SELECT datname FROM pg_database';
return (pg_query($link, $sql));
}
function pg_list_tables($link)
{
$sql = "SELECT relname FROM pg_class WHERE relname !~ '^pg_'";
return (pg_query($link, $sql));
}
--was--
I've tried to mimic the following mysql database connection functions for postgres.
http://www.php.net/manual/en/function.mysql-list-dbs.php
http://www.php.net/manual/en/function.mysql-list-tables.php
These are assuming that you're passing in $link as the result from pg_connect:
function pg_list_dbs($link)
{
$sql = 'SELECT datname FROM pg_database';
return (pg_exec($link, $sql));
}
function pg_list_tables($link)
{
$sql = "SELECT relname FROM pg_class WHERE relname !~ '^pg_'";
return (pg_exec($link, $sql));
}
http://www.php.net/manual/en/ref.pgsql.php