Yes... but notice you aren't getting the undefined variable errors.
Now you are getting an error connecting to the database:
localhost.php on line 9
This means that the specified database name is incorrect.
On the live server you probably can't use "localhost" you need to use the database ip address provided by the service provider.