Received: from ms1.eranet.net (ms1.eranet.net [203.95.230.34]) by hub.org (8.9.1/8.9.1) with ESMTP id WAA04426 for ; Fri, 15 Jan 1999 22:41:25 -0500 (EST) (envelope-from jwlo@ms11.hinet.net) Received: from ms11.hinet.net (n073.n203-95-235.eranet.net [203.95.235.73]) by ms1.eranet.net (8.9.1a/8.9.1) with ESMTP id LAA06170 for ; Sat, 16 Jan 1999 11:41:08 +0800 (CST) Sender: kevin@ms1.eranet.net Message-ID: <36A00A43.8818D61E@ms11.hinet.net> Date: Sat, 16 Jan 1999 11:40:52 +0800 From: Kevin Lo X-Mailer: Mozilla 4.5 [en] (X11; I; FreeBSD 2.2.8-RELEASE i386) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-interfaces@postgreSQL.org Subject: Help! DBI Pg problems. Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Transfer-Encoding: 7bit Hi, I'm trying to use Postgres DBI, which is Pg, to write a simple cgi script. But I encounter a problem, hope anyone can tell me how to do, thanks. For example: I have two input forms in ex.html, which names are 'id' and 'student'. I want to insert them into 'course' table in student database by using Pg. The script I wrote as following: #!/usr/local/bin/perl require 'forms-lib.pl';/* this script gets form values in HTML that I input */ use DBI; print "Content-type: text/html\n\n"; print "\n"; print "\n"; print "Data inserted\n"; print "\n"; %input = &GetFormInput(); $v1 = $input{'id'}; $v2 = $input{'student'}; $dbh = DBI->connect("dbi:Pg:dbname=student") or die $DBI::errstr; $sth = $dbh->prepare("insert into course values('$v1', '$v2')") or die $DBI::errstr; $sth->execute or die $DBI::errstr; print "\n"; print "

Data inserted!

\n"; print "\n"; print "\n"; After executing this script, I just see brower's title "Data inserted", I can't see "Data inserted!" in HTML and can't insert values into 'course' table. I don't know how to do, would anyone tell me, thanks in advance. Best regards, Kevin.