Re: PostgreSQL and HTML output
| From: | Yasuo Ohgaki | Date: | Sat, 19 Oct 2002 01:57:24 +0000 |
| Subject: | Re: PostgreSQL and HTML output | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-22509@lists.php.net to get a copy of this message | ||
If you need to dump query result for debugging purpose, etc.
Try something like,
<?php
$db = pg_connect();
$result = pg_query($db, 'SELECT * FROM some_table');
echo "<pre>\n";
var_dump(pg_fetch_all($result));
echo "</pre>\n";
?>
You need PHP 4.3.0-dev or later for pg_fetch_all().
--
Yasuo Ohgaki
Yasuo Ohgaki wrote:
> Edwin Robertson wrote:
>
>>With psql you can get all your output in HTML format. Anyone know of a way
>>to do this in PHP?
>
>
> It's psql feature and there is no automatic HTML format
> in PHP's pgsql module.
>
> If really would like, you can use passthru() and psql.
>
> <?php
> passthru('/usr/local/pgsql/bin/psql -f select.sql -H -U yohgaki -d test');
> ?>
>
> where "select.sql" is query you need.
>
> --
> Yasuo Ohgaki
>