Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 1739065049E for ; Wed, 30 Jul 2008 13:36:11 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 78441-04-5 for ; Wed, 30 Jul 2008 13:36:03 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.172]) by postgresql.org (Postfix) with ESMTP id 85C1B6501C9 for ; Wed, 30 Jul 2008 13:35:37 -0300 (ADT) Received: by wf-out-1314.google.com with SMTP id 25so71367wfc.28 for ; Wed, 30 Jul 2008 09:35:35 -0700 (PDT) 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=P4MBmh5LiabTHPgOXci3OPWCFz0RWR6YDb7wj+wf19s=; b=nR9LAQt+UBZ82PXyuCjMiNe2qnXFB5QguCQRxlDiCd3/cdyp+p6MW5S5SEb8hQ9r+D TdognMzwDCbnzO2es4FPROWqOlRgIdZoJGfzQSwfatclkGcAM6phBmwwWAaN1+LAOVFk 9LyO5fccs/gOAS9NbB2dSXNvyTUrNikcKexso= 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=hNpC0Xu63y6D9bnemyuOk0SY/Xoys7jeXBt23abwywoSJCIUbNhKmcMbDh+lU6eY5e /F0MMMqxbnVxGIRbkspG3JI9TxivmTBBclrcLM89fWrJaSpbvRQkMa68gNDAt7jOn7HA zNP38Db1fW60z2KgLaQ2UEYnhS7N8t/ARNohA= Received: by 10.142.54.17 with SMTP id c17mr2811922wfa.278.1217435735100; Wed, 30 Jul 2008 09:35:35 -0700 (PDT) Received: by 10.143.38.13 with HTTP; Wed, 30 Jul 2008 09:35:34 -0700 (PDT) Message-ID: Date: Wed, 30 Jul 2008 12:35:34 -0400 From: "Matthias Ritzkowski" To: PJ Subject: Re: display query results Cc: pgsql-php@postgresql.org In-Reply-To: <48909454.7040305@videotron.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <48909454.7040305@videotron.ca> 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: 200807/2 X-Sequence-Number: 3866 Try this: $db = pg_connect("host=localhost port=5432 dbname=med user=med password=0tscc71"); if (!$db) { die("Could not open connection to database server"); } // generate and execute a query $query = "SELECT description FROM glossary_item WHERE name='Alcohol'"; $result = pg_query($db, $query) or die("Error in query: $query. " . pg_last_error($db)); // Print result on screen while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) { foreach ($line as $col_value) { echo $col_value."
"; } pg_close($db); The result set is an array, You just need to loop through it. The php manual has some nice examples that helped me get started. -------------------------------- Matthias Ritzkowski