I'm sure this has come up before, however I think I'll ask again just in case. I'm trying to get my web page running like so many others do where I can just type my update into a form, it throws that information into a mysql database, then the front page pulls the last say... 3 entries from the database and displays them on the front page. I'm having trouble trying to figure out where to even start, so far I have this:
#!/usr/bin/perl -w use CGI qw(:standard); use DBI; use strict; my @list = ''; print header; print start_html; my $dbh = DBI->connect('DBI:mysql:test') or die "Trouble opening datab +ase: $DBI::errstr; stopped"; my $sth = $dbh->prepare("SELECT name, data, ID FROM frog WHERE ID like + '%'") or die "Trouble preparing statement: $DBI::errstr; stopped"; $sth->execute() or die "Trouble executing statement: $DBI::errstr; sto +pped"; while ( my ($blankfield, $data) = $sth->fetchrow_array() ) { push @list, $data; } my $i = $#list; while ($i >= ($#list - 2)) { print $list[$i--], "<BR>\n"; } $dbh->disconnect(); print end_html;
It runs a lot slower than it should, and I'm not sure why. Also, if there are multiple columns in my database, I don't know how to associate the columns with each other. Right now I can only pull up data from one column (the script is getting data from the first 2 columns, ignoring the first, and only saving what's in the second. That's intentional because I had no other idea how to do this). Any ideas on this?

In reply to [untitled node, ID 41059] 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.