Re: [GENERAL] PHP3 and PostgreSQL

From: Jeff Davis <jeff95350(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] PHP3 and PostgreSQL
Date: 2000-02-20 21:33:34
Message-ID: 20000220213334.15268.qmail@web3001.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)hotmail(dot)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

Browse pgsql-general by date

  From Date Subject
Next Message Differentiated Software Solutions Pvt. Ltd. 2000-02-21 09:11:48 Postgres grows in RAM
Previous Message eschmid 2000-02-20 21:20:59 Re: [GENERAL] PHP3 and PostgreSQL