Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 35A8C64FC42 for ; Fri, 2 Jan 2009 13:28:47 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 83402-02 for ; Fri, 2 Jan 2009 13:28:44 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.180]) by mail.postgresql.org (Postfix) with ESMTP id E09E664FC41 for ; Fri, 2 Jan 2009 13:28:43 -0400 (AST) Received: by wa-out-1112.google.com with SMTP id j4so3558852wah.19 for ; Fri, 02 Jan 2009 09:28:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=8f3zAxMab/RWhOV+tvmMOnewPVDWAWr7wfIPr1R2zBI=; b=VvF3y9R19CjLrIqfA7q0HKZYylQmHMHK/xrT5Rm2STV+x8q0bckgUAotzV4r32UpgI 0FV9OZggoV/rJ40FedTAPBst8zmixdIjs6j2QtMpCKqdl7vwyJLaPwiLuX9Kr9QHSR+D jrVewKKL6ISJsj/5YcEP+UH8CtlWkgGcBb9nU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=UBy+iYSKhiJlYYElTIN66GsnOravU22Pe8b/o8aFI+RVfYEJRdPJvdQ+Uth13Sw7Ob D3qsYefby40vH9C3k4zrFiph8F7qgf4nLYL853vtM4ZyhPeIPCgq21LMQRTn0fuEPE05 /ANSRjMoxxC3CmcfqQL9N+K4XY6F9bG5DCXII= Received: by 10.114.177.1 with SMTP id z1mr11915721wae.68.1230917322211; Fri, 02 Jan 2009 09:28:42 -0800 (PST) Received: by 10.114.135.4 with HTTP; Fri, 2 Jan 2009 09:28:42 -0800 (PST) Message-ID: Date: Fri, 2 Jan 2009 10:28:42 -0700 From: "Scott Marlowe" To: "Marc Fromm" Subject: Re: access data in php Cc: "pgsql-admin@postgresql.org" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200901/2 X-Sequence-Number: 31049 On Fri, Jan 2, 2009 at 10:11 AM, Marc Fromm 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?