Re: access data in php

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Marc Fromm" <Marc(dot)Fromm(at)wwu(dot)edu>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: access data in php
Date: 2009-01-02 17:28:42
Message-ID: dcc563d10901020928g6227a7fev357dddc9489f2b24@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Fri, Jan 2, 2009 at 10:11 AM, Marc Fromm <Marc(dot)Fromm(at)wwu(dot)edu> wrote:
> If I gather the sql results with this code
> $results = pg_query($dbconn,$query);
>
> I can check if there is no returned data with this code
> $rows = pg_fetch_assoc($result);
>
> but if I then use a while loop to display data (if there is data returned)
> with this code
> while ($row = pg_fetch_array($result)){ . . . }
>
> I have to execute this code a second time before the while loop
> $results = pg_query($dbconn,$query);
>
> If I do not execute the $results line a second time the while loop does not
> work properly.
>
> Why is $results loosing its value when it hits the while loop?

It shouldn't be. Got a complete, short sample that does this?

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message ioguix 2009-01-02 18:09:22 Re: access data in php
Previous Message Marc Fromm 2009-01-02 17:11:59 access data in php