logo       


Problem with PHP and PostgreSQL: msg#00017

Subject: Problem with PHP and PostgreSQL
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 
for($i = 0; $i < $fieldcounts; $i++)
 { 
        $fieldtype = pg_fieldtype($query_panels, $i); 
        echo "$fieldtype->name"; 
        if ($i < ($fieldcounts-1)) 
        echo ","; else echo "\n"; 
 } 
//**** Output each row of Data 
while ($myrow = pg_fetch_row($query_panels)) 
        { 
                for($i = 0; $i < $fieldcounts; $i++) 
                { 
                        $fieldname = pg_fieldname($query_panels, $i); 
                        if ($i < ($fieldcounts-1)) echo $myrow[$fieldname] . ", 
"; 
                        else echo $myrow[$fieldname] . "\n"; 
                } 
        }

Why do i get those errors?
Why is it not a valid result resource?
any help would be awsome.
Thanks,

Cameron Seader
mailto:CSeader@xxxxxxxxxxxxxx
1.208.388.2582 Office



[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 
intended recipient, you are hereby notified that any disclosure, copying, 
distribution, or use of the information contained herein (including any 
reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in 
error, please immediately contact the sender and destroy the material in its 
entirety, whether in electronic or hard copy format.  Thank you.   A2



---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings



Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe