MySQL操作程序三十八(Order summary网页程序2,整理2)

返回


mysql> show columns from sum; +--------------+---------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------------+---------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | year | int(11) | YES | | NULL | | | time | text | YES | | NULL | | | ref | text | YES | | NULL | | | owner | text | YES | | NULL | | | shipname | text | YES | | NULL | | | orderno | text | YES | | NULL | | | ordermoneyid | text | YES | | NULL | | | ordermoney | text | YES | | NULL | | | enq2name | text | YES | | NULL | | | enq2moneyid | text | YES | | NULL | | | enq2money | text | YES | | NULL | | | enq2no | text | YES | | NULL | | | enq2delivery | text | YES | | NULL | | | enq2pay | text | YES | | NULL | | | post | text | YES | | NULL | | | paytime | text | YES | | NULL | | +--------------+---------+------+-----+---------+----------------+ 17 rows in set (0.34 sec)
# mscsum.pl use strict; use DBI; my(%t,@rec,$pref,$n,$n1,$n2); print "This is mscsum.pl.\n"; # 连接数据库 $$pref{dsn} = "DBI:mysql:host=localhost;database=cookbook"; $$pref{dbh} = DBI->connect($$pref{dsn}, "cbuser", "cbpass") or die "Cannot connect to server\n"; $$pref{dbh}->do("SET NAMES utf8"); if(!$$pref{dbh}){ print "SQL read ERROR!\n"; exit; } @{ $t{ylist} } = qw/1 2 3 4/; print "Please input the year 2008=>1;2009=>2;2010=>3;2011=>4;select=>"; chop($t{y1}=<STDIN>); if ( $t{ylist}[$t{y1}-1] ) { print "You selection $t{y1} exists!\n"; } else { print "You selection $t{y1} does not exist!\n"; exit; } # 处理sum @{ $t{sumlist} } = $$pref{dbh}->selectrow_array("SELECT * FROM sum WHERE id = $t{y1}"); @{ $t{time} } = split(/==/,$t{sumlist}[2]); @{ $t{ref} } = split(/==/,$t{sumlist}[3]); @{ $t{owner} } = split(/==/,$t{sumlist}[4]); @{ $t{shipname} } = split(/==/,$t{sumlist}[5]); @{ $t{orderno} } = split(/==/,$t{sumlist}[6]); @{ $t{ordermoneyid} } = split(/==/,$t{sumlist}[7]); @{ $t{ordermoney} } = split(/==/,$t{sumlist}[8]); @{ $t{enq2name} } = split(/==/,$t{sumlist}[9]); @{ $t{enq2moneyid} } = split(/==/,$t{sumlist}[10]); @{ $t{enq2money} } = split(/==/,$t{sumlist}[11]); @{ $t{enq2no} } = split(/==/,$t{sumlist}[12]); @{ $t{enq2delivery} } = split(/==/,$t{sumlist}[13]); @{ $t{enq2pay} } = split(/==/,$t{sumlist}[14]); @{ $t{post} } = split(/==/,$t{sumlist}[15]); @{ $t{paytime} } = split(/==/,$t{sumlist}[16]); print "id=$t{y1},time=$#{ $t{time} }\n"; print "id=$t{y1},ref=$#{ $t{ref} }\n"; print "id=$t{y1},owner=$#{ $t{owner} }\n"; print "id=$t{y1},shipname=$#{ $t{shipname} }\n"; print "id=$t{y1},orderno=$#{ $t{orderno} }\n"; print "id=$t{y1},ordermoneyid=$#{ $t{ordermoneyid} }\n"; print "id=$t{y1},ordermoney=$#{ $t{ordermoney} }\n"; print "id=$t{y1},enq2name=$#{ $t{enq2name} }\n"; print "id=$t{y1},enq2moneyid=$#{ $t{enq2moneyid} }\n"; print "id=$t{y1},enq2money=$#{ $t{enq2money} }\n"; print "id=$t{y1},enq2no=$#{ $t{enq2no} }\n"; print "id=$t{y1},enq2delivery=$#{ $t{enq2delivery} }\n"; print "id=$t{y1},enq2pay=$#{ $t{enq2pay} }\n"; print "id=$t{y1},post=$#{ $t{post} }\n"; print "id=$t{y1},paytime=$#{ $t{paytime} }\n"; # 关闭数据库 $$pref{dbh}->disconnect; print "End.\n";
form画面的横排 <span style="float:left;width:100px;"> <table width="100" border="1" align="right" bgcolor=lawngreen><tr><td> 显示 </td></tr></table></span> <span><table width="100" border="1" align="left" bgcolor=lawngreen><tr><td> <form action="" method="post"><input type="submit" value="2011年度"> <input type="hidden" name="mode" value="NO"> <input type="hidden" name="year" value="4"> <input type="hidden" name="rm" value="modesum"> </form> </td></tr></table></span>
返回