[PHP-users 10227] Re: SELECT文が通らない
OZU
php-users@php.gr.jp
2002年9月18日 19:18:58 +0900
玉川さん
オオズです。
ありがとうございます。
> pg_connect(あるいはpg_pconnect)のところは、どんな
> ソースになっていますか?
こんな感じになっています。
__________________________________
// コネクションハンドルを返す
function getConnection() {
if ($this->con == false) {
return($this->doConnect());
}
return($this->con);
}
function doConnect() {
// データベースに接続する
@$this->con = pg_connect($this->hostname,$this->port,$this->dbname);
if ($this->con == false) {
print("データベース $this->dbname に接続できませんでした");
exit;
} else {
print("データベース $this->dbname に接続できました");
print("this−>conは $this->con です");
print("conは $con です");
}
return($this->con);
}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
これで実行しますと、
___________________________________
データベース foo に接続できました
this−>conは Resource id #1 です
conは です
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
と表示され、$conは空白でした。