Re: What's wrong with this? (Pt II)

From: GH <grasshacker(at)over-yonder(dot)net>
To: John Poltorak <jp(at)eyup(dot)org>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: What's wrong with this? (Pt II)
Date: 2001-01-22 02:36:09
Message-ID: 20010121203609.A3110@over-yonder.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Mon, Jan 22, 2001 at 01:31:16AM +0000, some SMTP stream spewed forth:
*snip*
> <?
> $connectid = pg_connect("194.164.53.200", "5432", "postgres");

This syntax is deprecated. What version of PHP are you using?
The more correct syntax would be
pg_connect("host=194.164.53.200 port=5432 user=<user>"
." password=<password> dbname=<database>");
http://www.php.net/manual/function.pg-connect.php
The same is true for pg_pconnect().

> $query = "SELECT townName FROM towns";
> $result = pg_exec($connectid, $query);
> $row = pg_fetch_array($result,$row);

What is the value of $row that you are passing to pg_fetch_array?
(That should be the number of the row *in the resultset* that you
want to retrieve.)

In addition, I recieved a pg_hba.conf error when I attempted to test
this script, using what you sent. Can you clarify what
the username, password, and database are supposed to be?

---
Warning: Unable to connect to PostgreSQL server: No pg_hba.conf entry for
host 63.147.13.10, user nobody, database postgres in
/depot/home/grasshacker/public_html/pg_test.php on line 10
---

gh

*snip*

> Can anyone try running this snippet on their own system and show
> me what happens?
Tried...did.
>
> It's coded to point at an host which _ought_ to be able to
> service a query.

It is not able to, at least, not in the context of this test.

>
> --
> John

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message info 2001-01-22 09:40:34 Re: What's wrong with this? (Pt II)
Previous Message John Poltorak 2001-01-22 01:31:16 What's wrong with this? (Pt II)