Hi Pau, in addition to what Shawn has written, here are a few comments on your code:
On Fri, 28 Oct 2011 15:22:26 +0200 Pau Marc Munoz Torres <paum...@gmail.com> wrote: > Hi everbody! > > I just discovered CGI.pm package and i think it's cool, but i still having > a couple of dubts > > Imagine i got a pice of script like that > > use DBI; > > use CGI; > Always start with "use strict;" and "use warnings;": http://perl-begin.org/tutorials/bad-elements/#no-strict-and-warnings > my $h=new CGI() ; That should be: my $h = CGI->new; See: http://perl-begin.org/tutorials/bad-elements/#indirect-object-notation You should also give a more meaningful variable name to the CGI instance than "$h". Maybe "$cgi". > ## some DB connection > > print $h->header; > print $h->start_html; > > my $query=$q->prepare("select name, age from student"); Where is $q coming from? $dbh is the common name for the DBI handle. > > $query->execute(); > > print "<TABLE>"; > while(my @data=Sq->featchrow_array()){ Well, ignoring the mis-spellings here and the fact that "$q" should be "$query". > > print "<TR><TD>$data[0]</TD><TD>$data[1]</TD></TR>\n"; Make sure you avoid HTML injection / Cross-site scripting (XSS) attacks here: http://en.wikipedia.org/wiki/Cross-site_scripting Regards, Shlomi Fish > > } > > print "</TABLE>"; > > print $h->end_html; > > > How do you would script the table part on cgi.pm, please, notice that the > table could be really hugh and take a long time to be compleatly written, so > , i would like to be printed as long as i'm reciving the data from the > select. > > Thanks > > P -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ My Aphorisms - http://www.shlomifish.org/humour.html There is no IGLU Cabal! Its members can be arranged in N! orders to form N! different Cabals. The algorithm to find which order formulates the correct IGLU Cabal is NP‐Complete. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/