small question php/postgreSQL

small question php/postgreSQL

am 07.11.2006 10:38:18 von coughlandesmond

--0-2038535160-1162892298=:90151
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

X-No-Archve: true

Hi,

I've been trying to get a small DB up and working with PhP. It's a library, and so far, I can't get past the stage of displaying a page. I try the 'hello world' example, and it displays. I then populate a DB and can access it via psql ..

cdi=> SELECT * FROM stock ;
-[ RECORD 1 ]-+-------------------------------
stock_ids | 1
isbn_no | 10101010
code_livre | 23455
titre | toto goes to Hollywood
editeur | editions toto
collection | collection toto
auteur_nom | smith
auteur_prenom | john
matiere | ang
media_type | li
-[ RECORD 2 ]-+-------------------------------
stock_ids | 2
isbn_no | 10536278
code_livre | 24874
titre | toto comes back from Hollywood
editeur | editions baba
collection | collection toto
auteur_nom | martin
auteur_prenom | peter
matiere | fre
media_type | dvd

OK, I then write the following script ....

pg_connect ("dbname=cdi user=cdi password=toto") or die ("Couldn't Connect: ".pg
_last_error());
$query="SELECT * FROM stock";
$query=pg_query($query);
// start the output
while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
echo "Title: ".$row['isbn_no']."
";
echo "blah ".$row['code_livre']."
";
}
?>

(sorry not to put that in italics or whatever...)

... and put it in the document root of my webserver, under php_experimental.

I get a blank page. The apache weblogs look like ...

192.168.0.254 - - [07/Nov/2006:10:37:30 +0100] "GET /php_experimental/base.php HTTP/1.1" 200 - "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"

There's something obvious that I'm missing. Any ideas ..?

Thanks.

D.


---------------------------------
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses.
--0-2038535160-1162892298=:90151--

Re: small question php/postgreSQL

am 07.11.2006 23:43:05 von Chris

Desmond Coughlan wrote:
> X-No-Archve: true
>
> Hi,
>
> I've been trying to get a small DB up and working with PhP. It's a library, and so far, I can't get past the stage of displaying a page. I try the 'hello world' example, and it displays. I then populate a DB and can access it via psql ..
>
> cdi=> SELECT * FROM stock ;
> -[ RECORD 1 ]-+-------------------------------
> stock_ids | 1
> isbn_no | 10101010
> code_livre | 23455
> titre | toto goes to Hollywood
> editeur | editions toto
> collection | collection toto
> auteur_nom | smith
> auteur_prenom | john
> matiere | ang
> media_type | li
> -[ RECORD 2 ]-+-------------------------------
> stock_ids | 2
> isbn_no | 10536278
> code_livre | 24874
> titre | toto comes back from Hollywood
> editeur | editions baba
> collection | collection toto
> auteur_nom | martin
> auteur_prenom | peter
> matiere | fre
> media_type | dvd
>
> OK, I then write the following script ....
>
> > pg_connect ("dbname=cdi user=cdi password=toto") or die ("Couldn't Connect: ".pg
> _last_error());

If that doesn't work - then you don't have the php-postgres library
installed.

Check your phpinfo page for "postgresql" - if it's not there, then
that's your problem.

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php