Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 0F5BA650090 for ; Wed, 30 Jul 2008 13:18:27 -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 62547-07 for ; Wed, 30 Jul 2008 13:18:23 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relais.videotron.ca (relais.videotron.ca [24.201.245.36]) by postgresql.org (Postfix) with ESMTP id 5534864FFC0 for ; Wed, 30 Jul 2008 13:18:24 -0300 (ADT) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=ISO-8859-1; format=flowed Received: from [192.168.0.51] ([96.21.103.185]) by VL-MO-MR002.ip.videotron.ca (Sun Java(tm) System Messaging Server 6.3-4.01 (built Aug 3 2007; 32bit)) with ESMTP id <0K4T00GDVUMN6M50@VL-MO-MR002.ip.videotron.ca> for pgsql-php@postgresql.org; Wed, 30 Jul 2008 12:18:23 -0400 (EDT) Message-id: <48909454.7040305@videotron.ca> Date: Wed, 30 Jul 2008 12:18:28 -0400 From: PJ User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) To: pgsql-php@postgresql.org Subject: display query results 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/1 X-Sequence-Number: 3865 I am trying to learn postgresql with psql - using FreeBS D7.0, postgresql 8.3.3 php 5.2.6, apache 2.2.9 How can I echo or print on screen the results; all I get from this code is this: Resource id #3 item_idglossary_idnamedescription which is the field names run together I am expecting to see several long text sentences. Here is the snippet and the connection does work and the database is there and functioning. $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 echo "$result"; pg_close($db); What am I doing wrong?