RE: [GENERAL] pg_result

From: "Rob den Boer" <rdboer(at)hrs-rotterdam(dot)nl>
To: <davez(at)istand(dot)com>
Cc: <pgsql-general(at)postgreSQL(dot)org>
Subject: RE: [GENERAL] pg_result
Date: 1998-06-26 07:30:14
Message-ID: 000901bda0d4$4287aa20$67032e9f@hrs_nt.hrs
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dave,

>
> $result = pg_Exec($conn, "$query");
> if (!$result);
> echo "An error occured inserting information into our
> database.\n";
> exit;
> else;
> pg_close ($conn);
> endif;
> $rows = pg_result($result,0,"row1");
>

(Assuming you're using php3)

I think something like this is what you're looking for:

$conn = pg_Connect("localhost", "5432", "", "", "efakt");
if (!$conn) {
echo "Cannot connect to PostgreSQL database.\n";
exit;
}

$result = pg_Exec($conn, "set datestyle='ISO';
select * from invoices
where seqid = $invid");
if (!$result) {
echo "Faktuur niet gevonden! ($resinv $invid)\n";
exit;
}

$num = pg_NumRows($result);
$i = 0;

while ($i < $num) {
echo pg_Result($result, $i, "invoiceno");
$i++;
}

pg_FreeResult($result);
pg_Close($conn);

Rob den Boer

In response to

  • pg_result at 1998-06-25 15:28:51 from davez

Browse pgsql-general by date

  From Date Subject
Next Message Moufida MASSRALI 1998-06-26 16:11:43
Previous Message Diab Jerius 1998-06-25 21:05:48 RE: [GENERAL] pg_result