sub mysql_query($$$$$$) {
    my($host, $port, $user, $password, $db, $query) = @_;

    use DBI;

    my($dsn) = "DBI:mysql:$db:$host;mysql_connect_timeout=15";
    my($dbh) = DBI->connect($dsn, $user, $password, { RaiseError => 0 });
    return("error: Couldn't connect to DB server '$host' as '$user': ".$DBI::errstr) unless ($dbh);
    my($result);
    my($sth) = $dbh->prepare(qq{$query});
    return("error: Couldn't prepare mysql query '$query': ".$dbh->errstr()) unless ($sth);
    my($res) = $sth->execute();
    unless ($res) {
	$result = "error: ".$DBI::errstr;
    } else {
	if ($query =~ /^select/i) {
#	    $result = $res->fetchrow_array();
$result = "";
	    $res->finish()
	} else {
	    $result = "";
	}
    }
    $dbh->disconnect();
    return($result);
}
