pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Marlowe <scott.marlowe@gmail.com>
To: Marc Fromm <Marc.Fromm@wwu.edu>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: access data in php
Date: Fri, 2 Jan 2009 10:28:42 -0700
Message-ID: <dcc563d10901020928g6227a7fev357dddc9489f2b24@mail.gmail.com> (raw)
In-Reply-To: <B0D7C0A3F35FE144A70312D086CBCA9B0213E18F15@ExchMailbox2.univ.dir.wwu.edu>
References: <B0D7C0A3F35FE144A70312D086CBCA9B0213E18F15@ExchMailbox2.univ.dir.wwu.edu>

On Fri, Jan 2, 2009 at 10:11 AM, Marc Fromm <Marc.Fromm@wwu.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?



view thread (8+ messages)  latest in thread

Message-ID: <dcc563d10901020928g6227a7fev357dddc9489f2b24@mail.gmail.com>
Permalink:  ../dcc563d10901020928g6227a7fev357dddc9489f2b24@mail.gmail.com/
Also on:    postgresql.org/message-id/dcc563d10901020928g6227a7fev357dddc9489f2b24@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: scott.marlowe@gmail.com, Marc.Fromm@wwu.edu
  Subject: Re: access data in php
  In-Reply-To: <dcc563d10901020928g6227a7fev357dddc9489f2b24@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox