in reply to My first MySQL database

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 */

Replies are listed 'Best First'.
Re: Re: My first MySQL database
by sulfericacid (Deacon) on Feb 10, 2003 at 19:10 UTC
    Since I haven't a clue on databases and this is my first try I just wanted to see if I could connect and print the contents on the DB. Once I figure that out I'll start writing to them.

    Thanks for your suggestions!

    "Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

    sulfericacid