#!/usr/bin/perl #----------------------- # program-ID:pet34.cgi # auther :t-egi # date :2002/1/22 #----------------------- use CGI; use DBI; $query = new CGI; my $iBango = $query->param('ibango'); my $iName = $query->param('iname'); my $iPetname = $query->param('ipetname'); my $iType = $query->param('itype'); my $iSex = $query->param('isex'); my $iOwner = $query->param('iowner'); my $iBirthday = $query->param('ibirthday'); my $iPhoto = $query->param('iphoto'); my $iComment = $query->param('icomment'); my $sw_UPDATE = $query->param('UPDATE'); my $sw_DELETE = $query->param('DELETE'); my $sw_INSERT = $query->param('INSERT'); print "Content-Type: text/html\n\n"; #----------- $username="egi"; $dbh = DBI->connect("dbi:Pg:dbname=egi",$username) or die "Cannot connect: " , $DBI->errstr; if($sw_UPDATE){ $iUpdate = "UPDATE pet_info Set banngo = ?, name = ?, petname = ?, type = ?, sex = ?, owner = ?, birthday = ?, photo = ?, comment = ?"; $iUpdate .= " Where banngo = ? "; $sth = $dbh->prepare($iUpdate) or die "Cannot prepare: ", $dbh->errstr(); $result = $sth->execute($iBango, $iName, $iPetname, $iType, $iSex, $iOwner, $iBirthday, $iPhoto, $iComment, $iBango) or die "Cannot execute: ", $sth->errstr(); $message = "更新しました"; } elsif($sw_DELETE){ $iDelete = "Delete from pet_info where banngo = ?"; $sth = $dbh->prepare($iDelete) or die "Cannot prepare: ", $dbh->errstr(); $result = $sth->execute($iBango) or die "Cannot execute: ", $sth->errstr(); $message = "抹消しました"; } elsif($sw_INSERT){ $iInsert = "INSERT INTO pet_info VALUES (?,?,?,?,?,?,?,?,?)"; $sth = $ dbh->prepare($iInsert) or die "Cannot prepare: ", $dbh->errstr(); $result = $sth->execute($iBango,$iName,$iPetname,$iType,$iSex,$iOwner,$iBirthday,$iPhoto,$iComment) or die "Cannot execute: ", $sth->errstr(); $message = "追加しました"; } #------------ print "<HTML>\n"; print "<HEAD><TITLE>更新結果</TITLE></HEAD>\n"; print "<BODY bgcolor=LINEN>\n"; print "<CENTER>\n"; print "<H4>\n"; print "ペット情報テーブルの管理<br><hr>\n"; print "<I>更新結果</I>\n"; print "<P>$message<br>"; print "<P><A HREF=./pet31.cgi>戻る</A>"; print "</CENTER>\n"; print "</BODY>\n"; print "</HTML>\n";