Re: Re: Bad column offset?

From: "Mauricio C(dot) de Oliveira" <carvalho(at)dt(dot)fee(dot)unicamp(dot)br>
To: pgsql-general(at)hub(dot)org
Subject: Re: Re: Bad column offset?
Date: 1999-01-26 11:45:49
Message-ID: 36ADAAED.D0D1B4E2@dt.fee.unicamp.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Paulo!

In your query you have the following select:

> $result = pg_exec( $pgconn, "select htl.nom_htl from htl where
> htl.des_det_htl='s'" ) or die("Query formatted wrong!");

Everything goes well until you try:

> $temp = pg_result($result, $i, "htl.nom_htl");
>
> Warning: Bad column offset specified in
> /usr/local/etc/httpd/htdocs/myscript.php3 on line 21

Even though you have requested the column "htl.nom_htl" from the table "htl", an error is generated since the column label returned
by postgres is simply "nom_htl", hence the bad column offset (label, in this case)! Of course you can change this label by using an
alias. Try replacing the label in the "pg_result" by:

$temp = pg_result($result, $i, "nom_htl");

This should work. Bye, Mauricio

--
Mauricio Carvalho de Oliveira
mailto:carvalho(at)dt(dot)fee(dot)unicamp(dot)br
http://www.dt.fee.unicamp.br/~carvalho

Browse pgsql-general by date

  From Date Subject
Next Message Fabrice Scemama 1999-01-26 16:01:03 Re: Displaying Image BLOBs
Previous Message Luis Bezerra 1999-01-26 09:16:10 unsubscribe