文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>脚本编写比赛(9:游泳池)

脚本编写比赛(9:游泳池)

时间:2008-03-13  来源:starB6

#!C:\Perl\bin\perl -w  use DBI;
 
 
print "Hello \n";
 
# Open a connection
#  my $dbh = DBI->connect("dbi:DB2:sample", "DB2ADMIN", "db2admin", {RaiseError => 1});
# use VALUES to retrieve value from special register
 # my $stmt = "Values CURRENT DATE";
#  my $sth = $dbh->prepare($stmt);
#  $sth->execute();
# associate variables with output columns...
#  my $col1;
#  $sth->bind_col(1,\$col1);
#  while ($sth->fetch) { print "Today is: $col1\n"; }
#  $sth->finish();
#  $dbh->disconnect();
my $dbh=DBI->connect("dbi:DB2:Meiyl","wawe","ondemand");
my $stmt = "select * from swimpool";
my $sth = $dbh->prepare($stmt);
$sth->execute();
my $col1;
my $col2;
my $col3;
my $col4;
my $col5;
my $col6;
my $col7;
my $col8;
my $Volume;
  $sth->bind_columns(\$col1,\$col2,\$col3,\$col4,\$col5,\$col6,\$col7,\$col8);
   while ($sth->fetch) {
     chomp($col6);
    # print "$col1,$col2,$col3,$col4,$col5,$col6,$col7,$col8\n";
     if ($col6 =~ /o/)
     {
       # print "hahahah\n";
        $Volume=$col3*$col4*$col5*1000;
        print "$col2:\n   Volume of Water is :$Volume. \n";
      }
      else
      {
        $Volume=$col3*$col4*(($col7+$col8)/2)*1000;
        print "$col2:\n   Volume of Water is :$Volume. \n";
      }   
 } 
  $sth->finish();
  $dbh->disconnect();
相关阅读 更多 +
排行榜 更多 +
宝宝情商养成宝宝巴士

宝宝情商养成宝宝巴士

休闲益智 下载
燥热手机版

燥热手机版

飞行射击 下载
巨人狙击手安卓版

巨人狙击手安卓版

飞行射击 下载