Re: Where can I get error messages?

From: "dr_sad(surguttel)" <dr_sad(at)surguttel(dot)ru>
To: Jean-Luc Lachance <jllachan(at)nsd(dot)ca>
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: Where can I get error messages?
Date: 2002-08-30 06:26:04
Message-ID: 43953037134.20020830122604@surguttel.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

Sorry, but this sample doesn't work... :\
if I change phptype "pgsql" in DSN
(pgsql://$userid:$password(at)$dbhost/$database)
on "mysql", then get error message:"DB Error: connect failed", but
else if phptype=pqsql (as write in sample) nothing happyness and
result html code is:
<html>
<head>
<title>PostgreSQL PHP Test</title>
</head>
<body>
<table>

--
Best wishes, Andrey

Thursday, August 29, 2002, 9:43:37 PM, you wrote:
JLL> Here is a sample:

JLL> <html>
JLL> <head>
JLL> <title>PostgreSQL PHP Test</title>
JLL> <body>
JLL> <table>
JLL> <?php
JLL> require_once( 'DB.php');

JLL> $userid=...;
JLL> $password=...;
JLL> $dbhost=...;
JLL> $databse=...;

JLL> $db = DB::connect( "pgsql://$userid:$password(at)$dbhost/$database");
JLL> if( DB::iserror( $db))
JLL> {
JLL> die( "DB:connect " . $db->getMessage());
JLL> }

JLL> $sql = "select * from whatever";
JLL> $q = $db->query($sql);

JLL> if( DB::iserror( $q))
JLL> {
JLL> die( "Query " . $q->getMessage());
JLL> }

JLL> while( $row = $q->fetchRow( ))
JLL> {
JLL> ?>
JLL> <tr><td><?= $row[0] ?> </td>
JLL> <td><?= $row[1] ?> </td>
JLL> <td><?= $row[2] ?> </td>
JLL> </tr>
JLL> <?php
JLL> }
JLL> ?>
JLL> </table>
JLL> </body>
JLL> </html>

JLL> Make sure that you include /usr/share/pear in the include_path in
JLL> php.ini and restart httpd.

JLL> JLL

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(at)postgresql(dot)org)
>>
>> JLL> ---------------------------(end of broadcast)---------------------------
>> JLL> TIP 4: Don't 'kill -9' the postmaster

In response to

Browse pgsql-php by date

  From Date Subject
Next Message Zhidian Du 2002-09-01 06:09:26 How can I get metadate of a table in PHP3?
Previous Message Clinton Adams 2002-08-30 00:52:46 Re: How do I get the rec-id from an insert.