[PHP-users 28394] insert について

Katumi Miyao kattyan @ nakayosi.jp
2006年 2月 13日 (月) 21:55:02 JST


初めまして、宮尾です
現在自宅サーバでホームページの掲示板を作っているのですが、
INSERT文を実行してもDBに入力出来ずに困っております。
どこが悪いのか解らりません。
ご教授下さい。

プラットホーム
Apache-2.0.55 
PostgresSQL-8.0.4 
PHP 4.4.1 

権限設定
myweb=# \z
                Access privileges for database "myweb"
 Schema | Name | Type  |               Access privileges
--------+------+-------+-----------------------------------------------
 public | bbs  | table | {postgres=arwdRxt/postgres,web=arwd/postgres}
(1 row)

bbs.php (抜粋)
$dbcon = pg_connect("host=localhost dbname=myweb user=web password=****");
if (! $dbcon){
	echo "Can not connect the myweb of wing-server\n";
	exit;
}
$page = pg_escape_string($_POST['page']);
if ($page=="input"){
	$no = pg_escape_string($_POST['no']);
	$name = pg_escape_string($_POST['name']);
	$mail = pg_escape_string($_POST['mail']);
	$url = pg_escape_string($_POST['url']);
	$title = pg_escape_string($_POST['title']);
	$message = pg_escape_string($_POST['message']);
	$date = date('Y/m/j', time());
	$time = date('H時i分s秒', time());
	$insert = "insert into bbs (no, name, mail, url, title, message,
data, time) values ($no, '$name', '$mail', '$url', '$title', '$message',
'$date', '$time')";
	$res1 = pg_query($dbcon,$insert);
	echo"test1 $dbcon <BR>";
	echo"test2 $insert <BR>";
	echo"test3 $res1 <BR>";
	if (! $res1){
		trigger_error("query fail: ". $insert);
		echo "Can not connect the bbs of wing-server";
		exit;
	}
}
結果表示
test1 Resource id #2 
test2 insert into bbs (no, name, mail, url, title, message, data, time)
values (3, 'name', 'mail', 'url', 'title', 'test', '2006/02/13', '03時34分34秒') 
test3 
Can not connect the bbs of wing-server


☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
 Name         宮尾 勝巳(Katumi,Miyao)
 E−mail          kattyan @ nakayosi.jp
★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★


PHP-users メーリングリストの案内