Dear Monks
Greetings
I am learning CGI with MySQL connection. I am using following CGI script, which I got from some tutorial
#!/usr/bin/perl -wT
print "Content-type: text/html \n\n";
use DBI;
# Connect To Database
$database = "a_qtest";
$username = "a_read";
$password = "password";
$hostname = "localhost";
$db = DBI->connect("DBI:mysql:$database:$hostname", $username, $passwo
+rd);
if(!$db = DBI->connect("DBI:mysql:$database:$hostname", $username, $pa
+ssword))
print "Connection unsuccessful. Please check your login credentia
+ls. ".$DBI::errstr;
# Execute a Query
$query = $db->prepare("SELECT * FROM mytable");
$query->execute;
# How many rows in result?
$numrows = $query->rows;
# Display Results
while (@array = $query->fetchrow_array) {
($field1, $field2, $field3) = @array;
print "field1 = $field1, field2 = $field2, field3 = $field3
";
}
# Cleaning Up
$query->finish;
$db->disconnect;
exit(0);
I am getting following error
Internal Server Error
The server encountered an internal error or misconfiguration and was u
+nable to complete your request.
Please contact the server administrator, webmaster@myurl.com and infor
+m them of the time the error occurred, and anything you might have do
+ne that may have caused the error.
More information about this error may be available in the server error
+ log.
Additionally, a 404 Not Found error was encountered while trying to us
+e an ErrorDocument to handle the request.
----------------------------------------------------------------------
+----------
Apache/2.2.13 Server at www.myurl.com Port 80
I would be grateful if anyone provides me any clues.
Regards,
SanPerl