Re: [GENERAL] PHP3 and PostgreSQL - Mailing list pgsql-general

From Jeff Davis
Subject Re: [GENERAL] PHP3 and PostgreSQL
Date
Msg-id 20000220213334.15268.qmail@web3001.mail.yahoo.com
Whole thread Raw
List pgsql-general
I haven't tried using a fetch object before, but here
is something very similar:

for($i = 0; $row = pg_fetch_array($result,$i); $i++)
{
    $row[colName]...... // code goes here
}

I dont know why your similar while loop didn't work,
but I recommend a for loop, since that is what you
were emulating anyway. You can try using the
pg_fetch_object if you want, I see know reason that
wouldn't work.

Perhaps the result was only one row, and your program
tried to access the second. You can turn off
auto-error-printing by "@pg_function" (ie: $row =
@pg_fetch_object($result,$num) ), and maybe it will
work.

That should work fine, although I haven't tested it
yet.

Hope it helps,
Jeff Davis

--- sheila bel <sheilabel@hotmail.com> wrote:
> SORRY, WRONG SUBJECT IN PREVIOUS MESSAGE.
>
> Hi all,
>
> I'm trying to do the equivalent of the following
> command of
> mysql (inside PHP3 code) in postgreSQL.
>
> while (($row = mysql_fetch_object($result))) .....
>
> I know there is the pg_fetch_object($result, ?) but
> I don't
> know what to use for ?. I tried 0 and it does an
> exhaustive
> search. I tried using something like $num
>
> $num=0
> while (($row = mysql_fetch_object($result,$num)))
> ...
>
> $num++;
>
> this is the error message I get :
>
> Warning: Unable to jump to row 1 on PostgresSQL
> result index 2
>
> Any ideas ?
>
> thanks,
> -Sheila
>
______________________________________________________
> Get Your Private, Free Email at
> http://www.hotmail.com
>
>
> ************
>
>
__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

pgsql-general by date:

Previous
From: eschmid
Date:
Subject: Re: [GENERAL] PHP3 and PostgreSQL
Next
From: "Differentiated Software Solutions Pvt. Ltd."
Date:
Subject: Postgres grows in RAM