pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Giampiero Raschetti <giampiero.raschetti@popso.it>
To: James Macken <jmac@nemesis.com.au>
To: pgsql-sql@hub.org
Subject: Re: [SQL] PostgreSQL and PHP
Date: Thu, 24 Feb 2000 13:00:33 +0100
Message-ID: <38B51D61.8656DEF1@popso.it> (raw)
References: <001701bf7eb7$23a82400$ac7d2bcb@jay>


Did you really read the manual ?

From the php postgresSQL manual (pg_fetch_array)

Example 1. PostgreSQL fetch array

<?php 
$conn = pg_pconnect("","","","","publisher");
if (!$conn) {
    echo "An error occured.\n";
    exit;
}

$result = pg_Exec ($conn, "SELECT * FROM authors");
if (!$result) {
    echo "An error occured.\n";
    exit;
}

$arr = pg_fetch_array ($result, 0);
echo $arr[0] . " <- array\n";

$arr = pg_fetch_array ($result, 1);
echo $arr["author"] . " <- array\n";
?>



Prev

James Macken wrote:
> 
> To those of you who use PHP with PostgreSQL,
> 
> I'm trying to do a simple select inside a ".php3" script. The php3 script
> simply says something like (the linux machine is not turned on so I can't
> grab it exactly):
> 
> <?php
> $database = pg_connect("","","","mydb");
> pg_exec($database, "select * from mytable");
> echo "whatever"
> ?>
> 
> and all I get is (in the resulting web page):
> 
> whatever
> 
> In other words, it doesn't print out on the web page the query that I just
> made. Now have added the "nobody" web user to the list of authorised people
> and I have granted permission for nobody to do anything he likes to mydb.
> 
> Other things work however such as the echo command above and the "info" php
> command.
> 
> Any ideas?
> 
> James
> 
> ************

-- 
Best Regards
----------------------------
Ing. Giampiero Raschetti
Sistemi Innovativi
Banca Popolare di Sondrio
----------------------------

Attachments:

  smime.p7s (application/x-pkcs7-signature, 1.9K) download

view thread (3+ messages)

Message-ID: <38B51D61.8656DEF1@popso.it>
Permalink:  ../38B51D61.8656DEF1@popso.it/
Also on:    postgresql.org/message-id/38B51D61.8656DEF1@popso.it

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: giampiero.raschetti@popso.it, jmac@nemesis.com.au, pgsql-sql@hub.org
  Subject: Re: [SQL] PostgreSQL and PHP
  In-Reply-To: <38B51D61.8656DEF1@popso.it>
  References: <001701bf7eb7$23a82400$ac7d2bcb@jay> <38B51D61.8656DEF1@popso.it>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox