access data in php

From: Marc Fromm <Marc(dot)Fromm(at)wwu(dot)edu>
To: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: access data in php
Date: 2009-01-02 17:11:59
Message-ID: B0D7C0A3F35FE144A70312D086CBCA9B0213E18F15@ExchMailbox2.univ.dir.wwu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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?

Thanks

Marc

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Scott Marlowe 2009-01-02 17:28:42 Re: access data in php
Previous Message Ray Stell 2008-12-31 21:08:41 Re: Fwd: ssl database connection problems...