Re: first steps in PhP and PostgreSQL

From: Ben <bench(at)silentmedia(dot)com>
To: Desmond Coughlan <coughlandesmond(at)yahoo(dot)fr>
Cc: pgsql mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: first steps in PhP and PostgreSQL
Date: 2006-11-06 17:28:15
Message-ID: Pine.LNX.4.64.0611060928060.8155@GRD.cube42.tai.silentmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Have you checked your webserver error logs?

On Mon, 6 Nov 2006, Desmond Coughlan wrote:

> X-No-Archive: true
>
> Hi,
> I'm sure that it's a typo or something, but as I'm getting into PhP and PostgreSQL for the first time, I can't be sure.
>
> I have a db, called 'cdi' ..
>
> A 'SELECT * FROM stock;' gets me this in 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
>
> So the db is populated. I now do this in a file called base.php ..
>
> <?php
> 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']."<br />";
> echo "blah ".$row['code_livre']."<br />";
> }
> ?>
>
>
>
> I copy that file to my apache server, in php_experimental/base.php and access it via a browser.
>
> I don't get an error message. I instead get a blank page.
>
> Your advice would be welcome.
>
> 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.
>From pgsql-general-owner(at)postgresql(dot)org Mon Nov 6 13:20:33 2006
Received: from localhost (wm.hub.org [200.46.204.128])
by postgresql.org (Postfix) with ESMTP id B2E4F9FA136
for <pgsql-general-postgresql(dot)org(at)postgresql(dot)org>; Mon, 6 Nov 2006 13:20:32 -0400 (AST)
Received: from postgresql.org ([200.46.204.71])
by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024)
with ESMTP id 14382-01 for <pgsql-general-postgresql(dot)org(at)postgresql(dot)org>;
Mon, 6 Nov 2006 17:20:26 +0000 (UTC)
X-Greylist: from auto-whitelisted by SQLgrey-
Received: from mx01.bfk.de (mx01.bfk.de [193.227.124.2])
by postgresql.org (Postfix) with ESMTP id BD69C9F9806
for <pgsql-general(at)postgresql(dot)org>; Mon, 6 Nov 2006 13:20:19 -0400 (AST)
Received: from [10.119.110.2] (helo=mx00.int.bfk.de)
by mx01.bfk.de with esmtp id 1Gh88r-0002mS-A6; Mon, 06 Nov 2006 18:20:13 +0100
Received: from fweimer by bfk.de with local id 1Gh88r-00027m-60; Mon, 06 Nov 2006 18:20:13 +0100
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: DISTINCT is not quite distinct
References: <82lkmoy979(dot)fsf(at)mid(dot)bfk(dot)de> <454F47F7(dot)6090108(at)archonet(dot)com>
From: Florian Weimer <fweimer(at)bfk(dot)de>
Date: Mon, 06 Nov 2006 18:20:13 +0100
In-Reply-To: <454F47F7(dot)6090108(at)archonet(dot)com> (Richard Huxton's message of "Mon, 06 Nov 2006 14:34:31 +0000")
Message-ID: <827iy8xzjm(dot)fsf(at)mid(dot)bfk(dot)de>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-Virus-Scanned: Maia Mailguard 1.0.1
X-Archive-Number: 200611/324
X-Sequence-Number: 103420

* Richard Huxton:

> I take it SELECT DISTINCT bar... shows the same problem?

SELECT bar FROM baz does *not* show the duplicate row.

> If so, can you do:
> SELECT OID,xmin,cmin,xmax,cmax,bar FROM baz
> WHERE bar =3D <something with duplicates>

Even if I force a complete index scan, I get xmin =3D 1007617 for both
rows, the others are zero. The table hasn't got OIDs.

--=20
Florian Weimer <fweimer(at)bfk(dot)de>
BFK edv-consulting GmbH http://www.bfk.de/
Kriegsstra=DFe 100 tel: +49-721-96201-1
D-76133 Karlsruhe fax: +49-721-96201-99

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matt Miller 2006-11-06 18:25:09 cvs HEAD initdb: vacuuming database template1 ... FATAL: could not identify a comparison function for type aclitem
Previous Message Florian Weimer 2006-11-06 17:10:30 Re: DISTINCT is not quite distinct