From: Jean-Luc Lachance <jllachan@nsd.ca>
To: dr_sad(surguttel) <dr_sad@surguttel.ru>
Cc: pgsql-php@postgresql.org
Subject: Re: Where can I get error messages?
Date: Thu, 29 Aug 2002 11:43:37 -0400
Message-ID: <3D6E4129.FA61A0AA@nsd.ca> (raw)
References: <150770979970.20020828095147@surguttel.ru>
<3D6CEA4B.76516A2E@nsd.ca>
<193857726615.20020829095734@surguttel.ru>
Here is a sample:
<html>
<head>
<title>PostgreSQL PHP Test</title>
<body>
<table>
<?php
require_once( 'DB.php');
$userid=...;
$password=...;
$dbhost=...;
$databse=...;
$db = DB::connect( "pgsql://$userid:$password@$dbhost/$database");
if( DB::iserror( $db))
{
die( "DB:connect " . $db->getMessage());
}
$sql = "select * from whatever";
$q = $db->query($sql);
if( DB::iserror( $q))
{
die( "Query " . $q->getMessage());
}
while( $row = $q->fetchRow( ))
{
?>
<tr><td><?= $row[0] ?> </td>
<td><?= $row[1] ?> </td>
<td><?= $row[2] ?> </td>
</tr>
<?php
}
?>
</table>
</body>
</html>
Make sure that you include /usr/share/pear in the include_path in
php.ini and restart httpd.
JLL
"dr_sad(surguttel)" wrote:
>
> Hi, Jean-Luc.
> Can't find any documents about "DB::connect" at www.php.net :(
> Give me please any links to that.
> And why "pg_connect" does not work properly?
> Script ex.:
> ---- cut ---------
> <html>
> <body>
> <?
> printf("Hello, world!<br>");
> $s="host=dbserv port=5432 dbname=ll user=postgres password=gecnzr";
> if (($db=pg_pconnect ($s))===false) {printf("FALSE! No connection!<br>");}
> printf("This is the end of script<br>");
> ?>
> </body>
> </html>
> --- cut -----------
> No errors messages... "Hello, world!<br>" - is the last line in
> generated html text :\
>
> with respect, Andrey
>
> Wednesday, August 28, 2002, 9:20:43 PM, you wrote:
> JLL> Why don't you use the DB::connect instead?
>
> JLL> "dr_sad(surguttel)" wrote:
> >>
> >> I've installed Postgres 7.2.2 on Linux SuSE 8.0 Pro.
> >> >From other server (SuSE 8.0 Pro + Apache 2.0.39 + PHP 4.2.2) I'm trying
> >> to get access to Postgres database, using PHP-script:
> >>
> >> <html>
> >> <body>
> >> <? $db = pg_connect(...); ?>
> >> </body>
> >> </html>
> >>
> >> I've no errors messages both in PHP log and Postgres console, but HTML
> >> page was been generated this script are stoped on <body> tag. Where
> >> can I get error messages? That is possible troubles?
> >>
> >> Thank You
> >>
> >> --
> >> With respect, Andrey Sergeev
> >>
> >> ---------------------------(end of broadcast)---------------------------
> >> TIP 2: you can get off all lists at once with the unregister command
> >> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
> JLL> ---------------------------(end of broadcast)---------------------------
> JLL> TIP 4: Don't 'kill -9' the postmaster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: jllachan@nsd.ca, dr_sad@surguttel.ru
Subject: Re: Where can I get error messages?
In-Reply-To: <3D6E4129.FA61A0AA@nsd.ca>
References: <150770979970.20020828095147@surguttel.ru> <3D6CEA4B.76516A2E@nsd.ca> <193857726615.20020829095734@surguttel.ru> <3D6E4129.FA61A0AA@nsd.ca>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox