Hostgator php code error while creating a new database table
This is not a PHP error, but a MySQL error. Basically, as the error message says you're either not using the correct username, password or the user privileges haven't been flushed since you added the user. That is, I'm assuming that you've removed the username from the error message, and not trying to log in with an empty parameter.

You need to check that the selected user has access to the database in question, and that the privileges has been flushed. Using the MySQL CLI client you can do this by the following commands:

USE mysql;
SELECT host,db,user,password FROM db;
SELECT host,user,password FROM user;
FLUSH PRIVILEGES;


The latter should only be used after you've added, deleted or changed the permissions of any MySQL users in the above tables. If you don't have access, look at the MySQL manual for help on GRANT. Alternatively, search the web.