读书人

DBI fetchrow_array出现奇怪的循环解决

发布时间: 2012-02-02 23:57:14 作者: rapoo

DBI fetchrow_array出现奇怪的循环

Perl code
my $sth=$dbh->prepare("select * from coaches");$sth->execute();print header,start_html(-title=>"Sample Database",    -bgcolor=>"#66ff33");print "<div align='center'>";print h2("Contents of the\"coaches\" Table");print qq/<table border="1" cellpadding="10" bgcolor="white">/;while (my @val=$sth->fetchrow_array){print <<EOF;    <tr>    <td>$val[0]</td>    <td>$val[1]</td>    <td>$val[2]</td>    <td>$val[3]</td>    <td>$val[4]</td>    </tr>EOF    }



(output)5列n行的代码,只有前5行的第一列是希望获得了数据库的信息。
数据库里只有4行信息,应该怎么改?才能获得5列5行全部信息

[解决办法]
看不懂啊!再好好描述一下。


数据库里只有四行数据,为什么要获得5列5行?

读书人网 >perl python

热点推荐