X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3AA08D1D90E for ; Wed, 4 Feb 2004 21:17:06 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 59305-02 for ; Wed, 4 Feb 2004 17:17:03 -0400 (AST) Received: from Ariel2.idahopower.com (unknown [204.76.195.72]) by svr1.postgresql.org (Postfix) with SMTP id 16796D1D58E for ; Wed, 4 Feb 2004 17:17:02 -0400 (AST) Received: from 204.76.195.33 by Ariel2.idahopower.com with ESMTP (IPCo Mail Relay at your service (MMS v4.7);); Wed, 04 Feb 2004 14:11:37 -0700 X-Server-Uuid: c4da1ae6-7048-11d2-bc8e-00a083360239 Received: from bedford.idacorp.local ([172.18.201.66]) by midway.idacorp.local with Microsoft SMTPSVC(5.0.2195.6713); Wed, 4 Feb 2004 14:17:04 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: Problem with PHP and PostgreSQL Date: Wed, 4 Feb 2004 14:17:03 -0700 Message-ID: <71B8A8BEC516CF46835CA629156CF21163F7A3@bedford.idacorp.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP] Problem with PHP and PostgreSQL Thread-Index: AcPrY/0bEoY/4CMbTUCpdEcYmi+EjQAAB9yg From: "Seader, Cameron" To: scott.marlowe Cc: pgsql-php@postgresql.org X-OriginalArrivalTime: 04 Feb 2004 21:17:04.0035 (UTC) FILETIME=[3C795F30:01C3EB64] X-WSS-ID: 6C3FBF83502088-01-01 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/20 X-Sequence-Number: 2568 i did i just did not include that part of the code. sorry -----Original Message----- From: scott.marlowe [mailto:scott.marlowe@ihs.com] Sent: Wednesday, February 04, 2004 2:09 PM To: Seader, Cameron Cc: pgsql-php@postgresql.org Subject: Re: [PHP] Problem with PHP and PostgreSQL On Wed, 4 Feb 2004, Seader, Cameron wrote: > I am having trouble with the following loops and such and accessing Postg= reSQL database. > The errors i get are: >=20 > Warning: pg_num_fields(): supplied argument is not a valid PostgreSQL res= ult resource in /var/www/html/PMS/csv_export.php on line 108 >=20 > Warning: pg_fetch_row(): supplied argument is not a valid PostgreSQL resu= lt resource in /var/www/html/PMS/csv_export.php on line 118 >=20 > Here is my Code Below: > //**** SQL Query > $query_panels =3D sprintf("SELECT * FROM %s WHERE utctime AT TIME ZONE 'M= ST' BETWEEN '%s' AND '%s' ORDER BY utctime %s", $MM_param1__panels,$MM_para= m2__panels,$MM_param3__panels,$MM_param4__panels); > //**** Count Fields=20 > $fieldcounts =3D pg_num_fields($query_panels);=20 > //**** List fields as first Row=20 You need to connect to the database and execute your query: $conn =3D pg_connect("dbname=3Dbigdb host=3Dmyserver user=3Dme2"); $query_panels =3D sprintf("SELECT... ; $res =3D pg_query($conn,$query_panels); $fieldcount =3D pg_num_fields($res); etc... [INFO] -- Access Manager: This transmission may contain information that is privileged, confidential = and/or exempt from disclosure under applicable law. If you are not the int= ended recipient, you are hereby notified that any disclosure, copying, dist= ribution, or use of the information contained herein (including any relianc= e thereon) is STRICTLY PROHIBITED. If you received this transmission in err= or, please immediately contact the sender and destroy the material in its e= ntirety, whether in electronic or hard copy format. Thank you. A2