Bad column offset ? - Mailing list pgsql-general

From Paulo Parola
Subject Bad column offset ?
Date
Msg-id 00b401be4656$89acfd60$0300000a@cpqivx-2
Whole thread Raw
List 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@brazilinfo.com






pgsql-general by date:

Previous
From: Brian
Date:
Subject: 6.3.1 -> 6.3.2 problems
Next
From: Russ Welti
Date:
Subject: command line editing using GNU readline?