Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 10D54650308 for ; Wed, 30 Jul 2008 14:18:16 -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 18299-09 for ; Wed, 30 Jul 2008 14:18:11 -0300 (ADT) X-Greylist: delayed 00:46:15.799932 by SQLgrey-1.7.6 Received: from newmail.cranel.com (newmailout.cranel.com [66.192.200.226]) by postgresql.org (Postfix) with ESMTP id 4A9DD6502F2 for ; Wed, 30 Jul 2008 14:18:12 -0300 (ADT) X-AuditID: c0a82032-a8517bb000000a13-be-4890977ad9e8 Received: from POSTOFFICE.cranel.local (exchsvr01.cranel.local [192.168.1.38]) by newmail.cranel.com (Symantec Mail Security) with ESMTP id 1B54A13B6 for ; Wed, 30 Jul 2008 12:31:54 -0400 (EDT) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C8F261.C3BEEC29" Subject: Re: display query results Date: Wed, 30 Jul 2008 12:29:15 -0400 Message-ID: <82E74D266CB9B44390D3CCE44A781ED90B64DC@POSTOFFICE.cranel.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP] display query results Thread-Index: AcjyX+rPd7sPPtmPTDuhCT7jQzYlSAAAX244 References: <48909454.7040305@videotron.ca> From: "Spiegelberg, Greg" To: "PJ" , X-Brightmail-Tracker: AAAAAA== X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.82 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001, MIME_QP_LONG_LINE=1.819 X-Spam-Level: * X-Archive-Number: 200807/4 X-Sequence-Number: 3868 This is a multi-part message in MIME format. ------_=_NextPart_001_01C8F261.C3BEEC29 Content-Type: text/plain; charset="iso-8859-1" content-transfer-encoding: quoted-printable You need to fetch the results. See the pg_fetch_* family of functions for t= he one of your liking. $myarray =3D pg_fetch_all($results); print_r($myarray); Greg ________________________________ From: pgsql-php-owner@postgresql.org on behalf of PJ Sent: Wed 7/30/2008 10:18 AM To: pgsql-php@postgresql.org Subject: [PHP] display query results 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 =3D pg_connect("host=3Dlocalhost port=3D5432 dbname=3Dmed user= =3Dmed password=3D0tscc71"); if (!$db) { die("Could not open connection to database server"); } // generate and execute a query $query =3D "SELECT description FROM glossary_item WHERE name=3D'Alcohol'"; $result =3D 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? -- Sent via pgsql-php mailing list (pgsql-php@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-php CONFIDENTIALITY NOTICE: This e-mail communication and any attachments may co= ntain confidential and privileged information for the use of the designated= recipients named above. If you are not the intended recipient, you are her= eby notified that you have received this communication in error and that any= review, disclosure, dissemination, distribution or copying of it or its con= tents is prohibited. If you have received this communication in error; plea= se notify Cranel Incorporated immediately by telephone at 614-431-8000 or 80= 0-288-3475 and destroy all copies of this communication and any attachments.= =0A= ------_=_NextPart_001_01C8F261.C3BEEC29 Content-Type: text/html; charset="iso-8859-1" content-transfer-encoding: quoted-printable [PHP] display query results=0A= = =0A= =0A= =0A=
=0A=
You need to fetch= the results.  See the pg_fetch_* family of functions for the one of yo= ur liking.
=0A=
 
=0A=
 $myarray =3D pg_fetch_all($= results);
=0A=
 print_r($myarray);=0A=
 
=0A=
Greg
=0A=

=0A=
=0A= From: pgsql-php-owner@postgresql.org on= behalf of PJ
Sent: Wed 7/30/2008 10:18 AM
To: pgsql-php= @postgresql.org
Subject: [PHP] display query results
=0A=
=0A=

I am trying to learn postgresql with psql - using FreeBS D= 7.0,
postgresql 8.3.3 php 5.2.6, apache 2.2.9

How can I echo or pr= int 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.

H= ere is the snippet and the connection does work and the database is
there= and functioning.

        $db =3D= pg_connect("host=3Dlocalhost port=3D5432 dbname=3Dmed user=3Dmed
passwor= d=3D0tscc71");

        if (!$db)        {
    &n= bsp;   die("Could not open connection to database server");
&nb= sp;       }

    &nb= sp;    // generate and execute a query
   &= nbsp;    $query =3D "SELECT description FROM glossary_item WH= ERE
name=3D'Alcohol'";
        $res= ult =3D pg_query($db, $query) or die("Error in query: $query.
  = ;      " . pg_last_error($db));

  =       // Print result on screen
  &nbs= p;     echo "$result";

    &n= bsp;   pg_close($db);

What am I doing wrong?


--<= BR>Sent via pgsql-php mailing list (pgsql-php@postgresql.org)
To make cha= nges to your subscription:
http://www.postgresql.org/mailpref/pgsql-php

CONFIDENTIALITY NOTICE: This e-mail communication and any attachments= may contain confidential and privileged information for the use of the desi= gnated recipients named above. If you are not the intended recipient, you a= re hereby notified that you have received this communication in error and th= at any review, disclosure, dissemination, distribution or copying of it or i= ts contents is prohibited. If you have received this communication in error= ; please notify Cranel Incorporated immediately by telephone at 614-431-8000= or 800-288-3475 and destroy all copies of this communication and any attach= ments.=0A=

------_=_NextPart_001_01C8F261.C3BEEC29--