Re: [SQL] PostgreSQL and PHP

From: Giampiero Raschetti <giampiero(dot)raschetti(at)popso(dot)it>
To: James Macken <jmac(at)nemesis(dot)com(dot)au>, pgsql-sql(at)hub(dot)org
Subject: Re: [SQL] PostgreSQL and PHP
Date: 2000-02-24 12:00:33
Message-ID: 38B51D61.8656DEF1@popso.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


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
----------------------------

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Eisentraut 2000-02-24 16:21:51 Re: [SQL] database rights?
Previous Message Stefano Brozzi 2000-02-24 11:37:19 Re: [SQL] PostgreSQL and PHP