These are all good suggests, but I have yet another way.

I am not sure you said that you wanted to put the db table into an html table. Assuming that you simply wanted to get the data, extract in whole and then put it into an arbitrary html form or any form for that matter, you might try using fetchrow_hashref which I like because it allows you to preserve the column names as keys for easy access.

This means that if the column names are unknown or you change tables you will be able to reuse your script and have access to the column names.

I then use Template Toolkit as a template processor for displaying that data.

(I do like the idea of doing it one fell swoop so I will look into DBIx::XHTML.)

Edited by footpad, ~Wed Jan 2 07:11:39 2002 (GMT)


In reply to Re: How can I display an entire MySQL table in Perl? by jonjacobmoon
in thread How can I display an entire MySQL table in Perl? by bladx

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.