|
|||||
|
|
I can't access my MySQL database from my script. Perl->MySQL database access is supported in the form of Perl's DBI module. To access your MySQL database, you'll need to include your username and password in the Perl code where you establish your connection.(You should have received a MySQL username and password with your account information.) Using the DBI module, a database connection can be established as follows: use DBI;
$dbh = DBI->connect("DBI:mysql:yourdomain:localhost",'username',
'password',{'RaiseError'=> 1});
$sth = $dbh->prepare("select * from YOUR_TABLE");
$sth->execute();
$i=0;
while ($i < $sth->{'NUMROWS'}) {
$data = $sth->fetchrow;
print "$data\n";
$i++;
}
You would substitute your domain name, username and password in the appropriate
locations in the script sample above. Troubleshooting If you experience difficulties, check the following:
The combination of Perl and MySQL makes it easy to create dynamic web sites that perform a wide variety of tasks. To learn more about MySQL, be sure to checkout the book MySQL (New Riders, 1999).
Note: MMA technical support staff cannot provide
troubleshooting of problems with third-party CGI scripts including but
not limited to: Perl scripts, C/C++ binaries, PHP or web/database integration
unless these services are specifically contracted. For these services,
please see our Quote Request Form. |
||||
|
||||||
Copyright
© 1995-2000
Motivational Marketing Associates, LLC
All Rights Reserved.