Have you connected to your MySQL database?
PHP Code:
if(!mysql_connect('localhost''my_username''my_password')) exit('Unable to connect to DB');
mysql_select_db('my_db_name');