Hi, I am hoping some one can help me here...

I basically want to be able to output the contents of a mysql table:

--------------------------------------------------------- |Name | Address | Tel | Email | --------------------------------------------------------- | Bob | 1 London Road | 00000000000 | bob@london.co.uk | --------------------------------------------------------- | Tony | 10 Downing St | 99999999999 | tony@no10.co.uk | ---------------------------------------------------------

like this:

Name: Bob Address: 1 London Road Tel: 00000000000 Email: bob@london.co.uk Name: Tony Address : 10 Downing St Tel: 99999999999 Email: tony@no10.co.uk

Here's my current code:

use DBI; # my $sql = "SELECT * FROM win32_processor"; my $sql = "SHOW FIELDS FROM win32_processor"; # Connect to the database. if (! saracen_open_database_connection ( \$dbh, $program_config{saracen_database}, $program_config{saracen_admin_login}, $program_config{saracen_admin_pass} ) ) { # Indicate that a problem occured. return 0; } if (! saracen_execute_query(\$dbh, \$sth, $sql)) { return 0; } #output database results while (@row = $sth->fetchrow_array) { print "@row\n" }

Im afraid my perl or mysql knowledge isn't extensive enough to solve this problem. I can get a table of fields, and I can get a table of values, I just cant seem to put them together!

Cheers, Marcel


In reply to Perl/MySQL by Anonymous Monk

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.