pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: scott.marlowe <scott.marlowe@ihs.com>
To: Seader, Cameron <CSeader@idahopower.com>
Cc: pgsql-php@postgresql.org
Subject: Re: Problem with PHP and PostgreSQL
Date: Wed, 4 Feb 2004 14:09:08 -0700 (MST)
Message-ID: <Pine.LNX.4.33.0402041407530.29327-100000@css120.ihs.com> (raw)
In-Reply-To: <71B8A8BEC516CF46835CA629156CF211103829@bedford.idacorp.local>

On Wed, 4 Feb 2004, Seader, Cameron wrote:

> I am having trouble with the following loops and such and accessing PostgreSQL database.
> The errors i get are:
> 
> Warning: pg_num_fields(): supplied argument is not a valid PostgreSQL result resource in /var/www/html/PMS/csv_export.php on line 108
> 
> Warning: pg_fetch_row(): supplied argument is not a valid PostgreSQL result resource in /var/www/html/PMS/csv_export.php on line 118
> 
> Here is my Code Below:
> //**** SQL Query
> $query_panels = sprintf("SELECT * FROM %s WHERE utctime AT TIME ZONE 'MST' BETWEEN '%s' AND '%s' ORDER BY utctime %s", $MM_param1__panels,$MM_param2__panels,$MM_param3__panels,$MM_param4__panels);
> //**** Count Fields 
> $fieldcounts = pg_num_fields($query_panels); 
> //**** List fields as first Row 

You need to connect to the database and execute your query:

$conn = pg_connect("dbname=bigdb host=myserver user=me2");
$query_panels = sprintf("SELECT...  ;
$res = pg_query($conn,$query_panels);
$fieldcount = pg_num_fields($res);

etc...




view thread (4+ messages)  latest in thread

Message-ID: <Pine.LNX.4.33.0402041407530.29327-100000@css120.ihs.com>
Permalink:  ../Pine.LNX.4.33.0402041407530.29327-100000@css120.ihs.com/
Also on:    postgresql.org/message-id/Pine.LNX.4.33.0402041407530.29327-100000@css120.ihs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: scott.marlowe@ihs.com, CSeader@idahopower.com
  Subject: Re: Problem with PHP and PostgreSQL
  In-Reply-To: <Pine.LNX.4.33.0402041407530.29327-100000@css120.ihs.com>
  References: <71B8A8BEC516CF46835CA629156CF211103829@bedford.idacorp.local> <Pine.LNX.4.33.0402041407530.29327-100000@css120.ihs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox