Re: php + postgresql - Mailing list pgsql-general

From Leif B. Kristensen
Subject Re: php + postgresql
Date
Msg-id 200807241230.22905.leif@solumslekt.org
Whole thread Raw
In response to php + postgresql  (admin <mick@mjhall.org>)
Responses Re: php + postgresql
List pgsql-general
On Thursday 24. July 2008, admin wrote:

>It seems that some of PHP's PG functions have changed recently, are
>there any known issues with them?

I've been using PHP with PostgreSQL for 5 years, and haven't noticed any
substantial changes.

>while ($row = pg_fetch_array($query)) {
>   $content = $row[0]
>}
>
>echo $content;
>
>$content was always 'undeclared'.

You have to use an intermediate variable like a handle. Try this:

$handle = pg_query("SELECT whatever FROM foo");
while ($row = pg_fetch_array($handle) {
    $content = $row[0];
}

> Any pointers to good documentation covering PHP + PG, or any well
> known gotchas?

You can download my pg+php genealogy app "exodus" from here:

http://solumslekt.org/forays/exodus.tgz

The code is certainly not stellar, but it works for me. Note that the
code is intended for running in a private environment, and there are no
security features whatsoever.
--
Leif Biberg Kristensen | Registered Linux User #338009
Me And My Database: http://solumslekt.org/blog/
My Jazz Jukebox: http://www.last.fm/user/leifbk/

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: High activity short table and locks
Next
From: Ivan Sergio Borgonovo
Date:
Subject: Re: php + postgresql