Try removing the quotes from around the variable.
For example you have:
mysql_connect("$host", "$username", "$password")or die("cannot connect");
Believe it should be like:
mysql_connect($host, $username, $password)or die("cannot connect");
In PHP $ signifies the start of a variable. " signifies the start of a string. So "$ signifies the start of string starting with a dollar sign, not a variable.