On Oct 26, 2001 at 01:48 +0200, [EMAIL PROTECTED] took the soap box and proclaimed: : Hi to All, : I' d like to create a table in which put the data read from a database : using Perl Object-Oriented language. : Now I' ve created this functional table, and I' d like to re-write it in : object-oriented: : : use CGI; : use Win32::ODBC; : my $q = new CGI; : $db = new Win32::ODBC("DSN=connection.dsn;") : or die Win32::ODBC::Error(); : if ($db->Sql("SELECT Nation, Area, Permit FROM table : WHERE Nation LIKE '%@{[$q->param('nation')]}%' AND Area : LIKE'%@{[$q->param('area')]}%'")) { : print "SQL Error: " . $db->Error() . "\n"; : $db->Close(); : exit; : } : print $q->header("text/html"), : $q->start_html("Title"); : print "<table>" , : "<tr bgcolor=ffffcc align=center>" . : "<td>Nation</td>" . "<td>Area</td>" . "<td>Permit</td></tr>"; : while ($db->FetchRow){ : my ($Nation, $Area, $Permit) = $db->Data(); : print "<tr bgcolor=white align=center>" . : "<td>$Nation</td>" . "<td>$Area</td>" . "<td>$Permit</td></tr>"; : } : print "</table>"; : print $q->end_html; : $db->Close(); : : ----> I'd like to re-write table using this sintax:
What you are trying to do is creat a CGI object and use it to write your HTML. You should be able to use about the exact same syntax as you have below after you create the CGI object $q. my $q = CGI->new; Be sure to read the CGI.pm docs about this (perldoc CGI). : print $q->table( : {-border => 1}, : $q->Tr([ : $q->th({-bgcolor => "#ffffcc"}, : ["Nation", "Area", "Permit"]), : ]), : $q->Tr([ : $q->th({-bgcolor => "#ffffff"}), : $q->td(["Nation", "Area", "Permit"]), : ]) : ); : ecc.. : : Can someone help me? : Thanks in advance !! : Bye : Angelo : : : -- : To unsubscribe, e-mail: [EMAIL PROTECTED] : For additional commands, e-mail: [EMAIL PROTECTED] : Casey West -- Shooting yourself in the foot with Ada The Department of Defense shoots you in the foot after offering you a blindfold and a last cigarette. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]