Enclose $dbname with square bracket to avoid error when dbname has dash