Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: my first database

by rdfield (Priest)
on Feb 13, 2003 at 14:32 UTC ( [id://234987]=note: print w/replies, xml ) Need Help??


in reply to my first database

To be honest, this looks like a random selection of lines from the CGI and DBI pods :)

First up, SHOW TABLES isn't an SQL statement, so don't use that: something like $dbh->table_info is more like it.

Second up, you issue a disconnect to your database before you try to prepare your "SQL". There's no chance of that working at all - if you add  or die $dbh->errstr after prepare and execute statements you might get some better information (you are checking the webserver log file?)

Third up, you're issuing an end_html command and then printing some more lines (spaced with tabs - which a browser wouldn't honour anyway).

Fourth up, even if you move the end_html after the db related prints, it's going to print them out whether or not the submit is pressed - you need something like if (defined($cgi->param('submit')) {print ...} in there somewhere.

I suspect that you're in for a steep learning curve - have a look in Tutorials: there are several well written articles on the DBI and CGI topics.

rdfield

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://234987]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-25 03:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found