I generally use DBI as opposed to a specific DBI variant for database work. With that being said.

1) Where is $poemDB intialized at?
2) You never confirm database connection
3) Since you are only using 1 table from what I can see, why not directly connect to that db and table, as opposed to segregating into 2 lines?
4) You need to query the DB and return the results ala
# # Syntax is off I know, but I want to make the point # and allow the creator to find correct syntax as an # exercise # $query = 'SELECT * from $table'; $ret = $dbh->execute($query); for ( fetchrow($ret) ) { print "$_\n"; }
5) I don't see you adding anything back into the DB, is this intentional or was the code left out?

Thats all I can see at first glance, but it should be enough to get you rolling forward with this.

On a side note maybe you should segregate this from a CGI and work a a strict command line level to get a feel for interfacing with the database, and work out the functionality you want/need first. That was you will have a better feel for how you want to present data to the client through the browser..


/* And the Creator, against his better judgement, wrote man.c */

In reply to Re: My first MySQL database by l2kashe
in thread My first MySQL database by sulfericacid

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.