in reply to dbi 500 error
If you're getting a 500 error, this tells me you are running this through a Web server. You're not sending any output back to the client, so your error log is probably complaining about "Premature end of script headers". That doesn't mean your program is wrong, just that you either need to run it from the command line or convert it to a proper CGI program. However, I wouldn't have a CGI program issuing "CREATE TABLE" commands :)
Assuming your shebang line is correct, here's a simple, complete CGI program:
#!/usr/local/bin/perl -wT use strict; use CGI qw/:standard/ print header, start_html( -title => 'Test program' ), h1( 'Hello world' ), end_html;
Update: Ack! I see a problem in your program:
my $table = $dbh->prepare qq' CREATE TABLE players (realname CHAR(20), = gold CHAR(40))');
Take a close look at your single quotes! It looks like you missed a parentheses.
my $table = $dbh->prepare( qq' CREATE TABLE players (realname CHAR(20), gold CHAR(40))');
Further, I'm already seeing some database design issues that you need to think about. Include a non-identifying ID for the player. If you use the realname as the ID, you can't easily update it.
create table players ( player_id INTEGER NOT NULL, firstname VARCHAR(15), lastlast VARCHAR(20), gold INTEGER );
Now, have every table that needs to link to the players table use the player_id. You can then change the other data at will.
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (Ovid) Re: dbi 500 error
by Anonymous Monk on Jan 23, 2003 at 05:29 UTC | |
by Ovid (Cardinal) on Jan 23, 2003 at 18:10 UTC | |
|
Re: (Ovid) Re: dbi 500 error
by Anonymous Monk on Jan 18, 2002 at 03:08 UTC | |
by Ovid (Cardinal) on Jan 18, 2002 at 03:28 UTC | |
by Anonymous Monk on Jan 18, 2002 at 05:46 UTC |