home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 27 / CDROM27.iso / linux / lg / issue31 / web.pl < prev   
Encoding:
Perl Script  |  1998-07-29  |  963 b   |  46 lines

  1. #!/usr/bin/perl5
  2.  
  3. # Import modules of interst.
  4. use CGI qw/:standard :html3 :netscape/;
  5. use Msql;
  6.  
  7. # print out the HTML HEAD section
  8. print header,
  9.    start_html(
  10.       -author=>'webmaster@graphics-muse.org',
  11.       -title=>'My Little Tools',
  12.       -bgcolor=>'#FFFFFF', -text=>'#000000'
  13.    );
  14.  
  15. # Open the Msql connections and select the databases of interest.
  16. my $dbh1 = Msql->connect();
  17. $dbh1->selectdb('tools');
  18.  
  19. my $sth = $dbh1->query("SELECT * from tools");
  20. my @rows;
  21. my @result;
  22. while (@result = $sth->fetchrow)
  23. {
  24.    push( @rows, td({-align=>'CENTER', -valign=>'CENTER'}, $result[1]));
  25. }
  26. my $tools_list =
  27.       table( {-border=>1, -cellpadding=>'1', -cellspacing=>'5'},
  28.            Tr(@rows)
  29.       );
  30.  
  31. # Now print the complete table
  32. print
  33.    center(
  34.    table(
  35.       {-border=>1, -width=>'100%', -cellpadding=>1, -cellspacing=>5},
  36.  
  37.       Tr(
  38.          td({-align=>'CENTER', -valign=>'CENTER'}, $tools_list),
  39.       )
  40.    )
  41. );
  42.  
  43.  
  44. # End of HTML output.
  45. print end_html;
  46.