Teresa Raymond wrote:
Hello,
I was wondering if anyone could help me solve this problem. The script appears not to be connecting to the database. This script prints "Here we go" but never prints "Database connected". I used the format that the hosting company supplied. "DBI:mysql:$database:localhost","$username","$password"" Could it be that I use underscores in my database and user names?


#!/usr/bin/perl -w

use strict;
use DBI;
use CGI;

my ($dbh, $sth);
my $database = '';
my $username = '';
my $password = '';

print "Content-type: text/html \n\n";
print "<html><head><title>Database Output</title></head>";
print "<body><p>";
print "Here we go<br>";

$dbh = DBI -> connect("DBI:mysql:$database:localhost","$username","$password") or die $DBI::errstr;

If your script is dieing at the above point then the error message will be sent to the server log rather than to the screen. You should look into using fatals to browser for this, or rather than just using 'die' as above you should provide your own error handling. So, what does the server log have in it?


<snip>

http://danconia.org


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to