From: | Thorsten Haude <postgresql(at)thorstenhau(dot)de> |
---|---|
To: | pgsql-php(at)postgresql(dot)org |
Subject: | Re: pg_fetch_array() |
Date: | 2002-12-18 22:03:29 |
Message-ID: | 20021218220329.GK1604@eumel.yoo.local |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
Hi,
* Harry Waddell <waddell(at)caravan(dot)com> [2002-12-18 22:12]:
>Thorsten Haude <postgresql(at)thorstenhau(dot)de> wrote:
>> - - - Schnipp - - -
>> $result = pg_exec($dbh, $statement);
>> $row = 0;
>> while ($item = pg_fetch_array($result, $row, PGSQL_ASSOC))
>> {
>> doSomething($item);
>> $row++;
>> }
>> - - - Schnapp - - -
>>
>> What do I miss?
A clue-by-four, it seems.
>your using a while loop to process each result, but the last one which you
>expect to return NULL/failure has to evaluate pg_fetch_array first with the
>non-existent row index.
Of course. The only excuse I have is that I misread the documentation
in a really stupid way. (Not much of an excuse, is it?)
>You may be able to prepend @ to pg_fetch_array to supress the warning
>[you should check that $result is not NULL also], but I'd recommend
>using pg_NumRows and a for-loop instead.
Sure, I'll do that. I don't want to suppress anyone, much less
warnings.
Thanks for your patience.
Thorsten
--
Endorsing products is the American way of expressing individuality.
- Calvin
From | Date | Subject | |
---|---|---|---|
Next Message | scott.marlowe | 2002-12-18 22:04:01 | Re: pg_fetch_array() |
Previous Message | scott.marlowe | 2002-12-18 21:56:56 | Re: pg_fetch_array() |