RE: [GENERAL] pg_result
От | David Zampese |
---|---|
Тема | RE: [GENERAL] pg_result |
Дата | |
Msg-id | Pine.LNX.3.96.980625145620.12271B-100000@www.metwest.com обсуждение исходный текст |
Ответ на | RE: [GENERAL] pg_result ("Jackson, DeJuan" <djackson@cpsgroup.com>) |
Список | 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 по дате отправления: