hi dudes,

I have this weird CGI problem! It goes like this:

#!/usr/bin/perl -w #use CGI::Debug; use strict; use CGI; use DBI; my $q = new CGI; my $dbh = DBI->connect("DBI:mysql:database=test","test",""); my $sth = $dbh->prepare("select * from tab1"); $sth->execute; print $q->header, $q->start_html('test baze'), $q->start_table({-border=>undef}); while(my $ref = $sth->fetchrow_arrayref) { print $q->Tr({-align=>'center'},$q->td($$ref[0]),$q->td($$ref[ +1])); } $q->end_table; $q->end_html; $sth->finish; $dbh->diconnect;

but the output is without </TABLE> and </BODY> and </HTML>:

Content-Type: text/html; charset=ISO-8859-1 <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"><head><title>t +est baze</title> Can't locate object method "diconnect" via package "DBI::db" (perhaps +you forgot to load "DBI::db"?) at ./db.pl line 25. </head><body><table border><tr align="center"><td>Beki</td> <td>Bekic< +/td></tr><tr align="center"><td>Laza</td> <td>Lazic</td></tr><tr alig +n="center"><td>Sima</td> <td>Simic</td></tr>


I was doing it without CGI module, as I'm used to do it all the time, but want to use CGI module .. anyway I've read all of perldoc man regarding CGI modules and I'm not sure what goes wrong?!

thanks in advance!

In reply to weird CGI problem by Alex the Serb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.