#!/usr/bin/perl
#
# Cannonical Perl DBI connection to Mysql.
##############################################################################


use DBI;

$db = "username";	# your username (= login name  = account name )
$host = "127.0.0.1";    # = "localhost", the server your are on.
$user = $db;		# your Database name is the same as your account name.
$pwd = "mypassw";	# Your account password


# connect to the database.


$dbh = DBI->connect( "DBI:mysql:$db:$host", $user, $pwd)
		or die "Connecting : $DBI::errstr\n ";

$sql = "SELECT * FROM blah_table";


# executing the SQL statement.


$sth = $dbh->prepare($sql) or die "preparing: ",$dbh->errstr;
$sth->execute or die "executing: ", $dbh->errstr;

print "content-type: text/html\n\n";


# one of the functions to retrieve data from the table results 
# check perldoc DBI for more methods.


while ($row = $sth->fetchrow_hashref)		
{
	print $row->{'some_field_name'},'<BR>';	
}