$db is the name of the connection variable.
lets say your database name is "data" and your username is "trevor" and your pass is "trevor00"
have you created a user in your mysql database with the permissions to access that database? also, have you created the actual databse?
create database
Code:
create database trevor;
create user with administrative permissions
Code:
grant all privileges on *.* to trevor@localhost identified by 'trevor00';
now that connection script should work assuming that it resides on the same server as mysql.