Bad column offset ?

From: "Paulo Parola" <pparola(at)brazilinfo(dot)com>
To: "pgsql-general" <pgsql-general(at)postgreSQL(dot)org>
Subject: Bad column offset ?
Date: 1999-01-22 22:27:48
Message-ID: 00b401be4656$89acfd60$0300000a@cpqivx-2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


I am porting all my applications from mSQL to PostgreSQL. I am trying to
access the results from a query to PostgreSQL issued from within PHP3.

I connect with no problems to the database, and I can even get the number of
elements returned by my query like below:

$result = pg_exec( $pgconn, "select ... from ... where ..." ) or
die("Query formatted wrong!");
$elements = pg_numrows( $result );

But when I try to access some columns inside each row returned, as with the
lines below

line 59 $i=0;
line 60 $temp = pg_result($result, $i, "htl.nom_htl");

I get the following error:

Warning: Bad column offset specified in
/usr/local/etc/httpd/htdocs/myscript.php3 on line 60

I tried to make '$i=1' initially, but then I get the following error:

Warning: Unable to jump to row 1 on PostgresSQL result index 3 in
/usr/local/etc/httpd/htdocs/myscript.php3 on line 60

So how can I retrieve the values returned by my query with PostgreSQL?
What am I doing wrong?

TIA,

Paulo Parola
pparola(at)brazilinfo(dot)com

Browse pgsql-general by date

  From Date Subject
Next Message Russ Welti 1999-01-23 01:06:07 command line editing using GNU readline?
Previous Message Brian 1999-01-22 20:39:24 6.3.1 -> 6.3.2 problems