RE: [GENERAL] pg_result - Mailing list pgsql-general

From David Zampese
Subject RE: [GENERAL] pg_result
Date
Msg-id Pine.LNX.3.96.980625145620.12271B-100000@www.metwest.com
Whole thread Raw
In response to RE: [GENERAL] pg_result  ("Jackson, DeJuan" <djackson@cpsgroup.com>)
List pgsql-general
    Awe, I switched over to Perl, I forgot I started with a PHP
script.  I get it to interact with the table and I read through perldocs
on Pg, but I still can not figure out how to print up the result.
    I get this from it:
                Result PG_result=SCALAR(0x810e178)
                            Ntuples 10
                            NFields 11
                            Status 0
                            ResultStatus 2
                            Command Status
                            E_Message

    I am trying to get back 10 lines of information that each contain
11 fields.  Do you know what variable I should set up.  Do I need to set
up and array call since there are more than 1 line of data that I am
trying to call?


            This is what I have:

#!/usr/local/bin/perl

use Pg;


$database = "inquiries";
$conn = Pg::connectdb("dbname = $database");

$query = "select * from sales where acctid = 'dave'";
$result = $conn->exec("$query");
# should check to see if status is ok if not fail it
$status = $conn->status;
$errorMessage = $conn->errorMessage;
$cmdStatus = $result->cmdStatus;

$result_status = $result->resultStatus;
$ntuples = $result->ntuples;
$nfields = $result->nfields;

# Return HTML page
print "Content-type: text/html\n\n";
print "<html>\n";
print "<body BGCOLOR=white>\n";
print "<center>\n";
print "<h2>Transactions to Date</h2>\n";
print "<table><tr><td>\n";
print "Result $result<br>\n";
print "Ntuples $ntuples<br>\n";
print "NFields $nfields<br>\n";
print "Status $status<br>\n";
print "ResultStatus $result_status<br>\n";
print "Command Status $cmdStatus <br>\n";
print "E_Message $errorMessage<br>\n";
print "</td></tr></table>\n";
print "</body>\n";
print "</html>\n";

exit;



pgsql-general by date:

Previous
From: The Hermit Hacker
Date:
Subject: Re: a little question
Next
From: Stephan Doliov
Date:
Subject: re support.