use CGI;
use DBI;
## ...
$dbh=DBI->connect($dsn,$user,$password) or die $DBI::errstr;
## ...
You must look into the documentation of DBI.
| [reply] [d/l] |
IN order to connect a database using the CGI you will need a gateway program that implements the CGI to perform the connection, make the required queries and return the appropriate data using the Common Gateway Interface. If you wanted to use Perl to create the gateway program you probably would want to use the module DBD::mysql to access the database.
/J\
| [reply] |
Also check out the perl section of the (downloadable) MySQL reference manual. I found it a very succinct "how to". | [reply] |
You've gotten the right direction by others (to look at DBI), but you might also want to look into Class::DBI which you will love once you get it to work a little.
--
b10m
All code is usually tested, but rarely trusted.
| [reply] |
If you are new to CGI, you should have a look at Ovid's CGI course. It is very nice for the CGI beginner.
| [reply] |
gube, These books aren't too popular around here, and, in most cases, for good reason. However, I found this one particular thorough and well written: Larry Ullman's MySQL in the Visual Quickstart series. It will give you a nice overview and a springboard into the more complex resources. Thought I should point it out.
—Brad "The important work of moving the world forward does not wait to be done by perfect men." George Eliot
| [reply] |