是否可以在Perl CGI中更新表

时间:2014-10-14 19:00:22

标签: html perl cgi

我从拥有大量记录的数据库中获取记录。因此,构建完整的表结构并打印表需要很长时间来显示记录,因为每个记录也需要后处理。我想知道是否可以在处理每条记录后用表更新表。

push @rows, TR(
    { class => 'row-2-center' },
    td( { class => 'category-center' }, [ FirstName LastName PhoneNumber ] )
);

$sth = db_cmd( $dbh1, $statement );
while ( $r = $sth->fetchrow_hashref ) {
    push @rows, TR( { class => 'row-2' }, @TEMP );    # Temp is the processed value
}

print table( { class => 'width100', cellspacing => 1 }, @rows );

现在正在处理这个问题。但我需要它像

push @rows, TR(
    { class => 'row-2-center' },
    td( { class => 'category-center' }, [ FirstName LastName PhoneNumber ] )
);

print table( { class => 'width100', cellspacing => 1 }, @rows );

$sth = db_cmd( $dbh1, $statement );

while ( $r = $sth->fetchrow_hashref ) {
    push @rows, TR( { class => 'row-2' }, @TEMP );    # Temp is the processed value
    print table( { class => 'width100', cellspacing => 1 }, @rows );
}

但它将其写为另一个表我需要更新同一个表。任何人都可以帮助我。

1 个答案:

答案 0 :(得分:1)

如果你想使用一个表,并在时间输出一行,

use CGI qw/*table TR td/;

print start_table();

print TR (
  {class => 'row-2-center'},
  td ({class => 'category-center'}, [qw/FirstName LastName PhoneNumber/])
);
# print TR ..

print end_table();