Re: php + postgresql

From: "Leif B(dot) Kristensen" <leif(at)solumslekt(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: php + postgresql
Date: 2008-07-24 10:30:22
Message-ID: 200807241230.22905.leif@solumslekt.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ivan Sergio Borgonovo 2008-07-24 10:52:04 Re: php + postgresql
Previous Message Richard Huxton 2008-07-24 10:19:34 Re: High activity short table and locks