generating tables on the fly ?

S

smrtalec

I am trying to scavange a example script I found on the web. The aubroutine
is below. Basically I want to extract data from a sql db then generate a
table of values on the fly. The script below keeps generating a malformed
header error

sub gen_table {
my $array_ref=query_data('%Ave%');

my @headings = ('id no.','street no.','street name','city');
my @rows = th(\@headings);
foreach my $row_array (@$array_ref) {
my ($id,$str_no,$str_name,$city) = @$row_array;
push(@rows,"td([$id,$str_no,$str_name,$city])");
}
print table({-border=>undef,-width=>'25%'},
caption(b('Wow. I can multiply!')),
Tr(\@rows)
);

}
 
T

Tad McClellan

smrtalec said:
The script below


What is below is not a script, merely a fragment of one.

keeps generating a malformed
header error


There is no such Perl error.

Must be some other kind of error.

push(@rows,"td([$id,$str_no,$str_name,$city])");
^ ^
^ ^

What's with the quotes?

Don't you want to call some function named td() ?
 
S

smrtalec

push(@rows,"td([$id,$str_no,$str_name,$city])");
^ ^
^ ^

What's with the quotes?

Don't you want to call some function named td() ?
actually I put the quotes in hoping it would help. the error generated is
taken from my apache error_log
 
S

Scott Yanoff

smrtalec said:
I am trying to scavange a example script I found on the web. The aubroutine
is below. Basically I want to extract data from a sql db then generate a
table of values on the fly. The script below keeps generating a malformed
header error

Are you printing a content-type header in your script?
Something akin to
print "Content-type: text/html\n\r\n\r";

-Scott
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top