Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-03-28 18:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found