"document contains no data" - Mailing list pgsql-general

From Michael
Subject "document contains no data"
Date
Msg-id 4.2.0.58.20000209155350.00a76dd0@mail.w3workshop.com
Whole thread Raw
List pgsql-general
I have just installed PHP on my new Cobalt RaQ3i, which came with
PostgreSQL already installed.  Both PHP and PostgreSQL work
independently.  I have created several sample databases using psql.  My
test PHP scripts embedded in html work.  But when I try to use PHP to
access a PostgreSQL all I get is the "document contains no data"
message.  The PHP script I was trying to use is the one from the online
tutorial at http://cs.sau.edu/~cfisher/uw/018.html#06. I first created the
grocery database just as described in the tutorial, so I'm certain the
database is there and accessible through psql.  The script looks like this:

View Database Records
item vendorname quantity
<?PHP $conn = pg_Connect("", "", "", "", "grocery"); if (!$conn) { echo "An
error occurred.\n"; exit; } $result = pg_Exec($conn, "SELECT list.item,
vendors.vendorname, list.quantity FROM list, vendors WHERE list.vendorcode
= vendors.vendorcode ORDER BY list.item;"); if (!$result) { echo "An error
occurred.\n"; exit; } $num = pg_NumRows($result); $i = 0; while ($i < $num)
{ echo "
"; echo pg_Result($result, $i, "item"); echo ""; echo pg_Result($result,
$i, "vendorname"); echo ""; echo pg_Result($result, $i, "quantity"); echo "
"; $i++; } pg_FreeResult($result); pg_Close($conn); ?>


My PostgreSQL was installed to require user authorization, so I've tried
modifying the pg_connect line in the tutorial script like so:
$conn = pg_Connect("dbname=grocery user=mstrait password=michael");
but it didn't make a difference.

I need some help on where else to look for the problem.  If it matters, I'm
using PHP Version 3.0.14, PostgreSQL 6.5, and the web server is Apache
1.3.6.  The platform is a Cobalt RaQ3i running Linux 2.2.

Thanks.
Michael Strait
mstrait@w3workshop.com

pgsql-general by date:

Previous
From: "Sam Juvonen"
Date:
Subject: Help needed with DBI and DBD::Pg
Next
From: "MICHAEL POON"
Date:
Subject: how can we do STORED PROCEDURE in PostgreSQL?