$dname is the connection to your MySQL database. With your original error, it means $dbname is null which means it failed to connect to MySQL for some reason.
After speaking to the hosting provider it seems the error was the way that the php duplicated reference to the database.
to get this to work I had to change the syntax to:
and take out the reference to the DBNAME as follows:
Would this be anything to do with conflicting versions of php?.