RE: [GENERAL] pg_result

From: David Zampese <davez(at)istand(dot)com>
To: "Jackson, DeJuan" <djackson(at)cpsgroup(dot)com>
Cc: Jason <neumeier(at)bright(dot)net>, pgsql-general(at)postgreSQL(dot)org
Subject: RE: [GENERAL] pg_result
Date: 1998-06-25 19:01:20
Message-ID: Pine.LNX.3.96.980625145620.12271B-100000@www.metwest.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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;

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Olive Liew 1998-06-25 19:52:00 Re: a little question
Previous Message The Hermit Hacker 1998-06-25 18:56:58 Re: a little question