I want to connect to my database but it only works when I use localhost, if I try and use the ip it does not work.

this works:
$db = mysql_connect("localhost", "$user", "$password" );

this does not works:
$db = mysql_connect("", "$user", "$password" );

( is a fake ip of course)

any ideas... thanks
Have you tried to see what error it returns using the mysql_error() function in a "or die()" construct? Read the documentation on the details of this, since my copy and paste isn't so much working right now. Does the username you're trying to connect with have access to connect from the server you're connecting from? In MySQL, usernames are usually associated with a particular address, e.g. user@localhost or user@'10.0.0.%'. If the username you're trying to connect with only has access from a certain address (e.g. user@localhost can only connect if it's connecting from the same machine -- localhost), then the won't be able to connect from anywhere else. So if you're connecting from the (and that's not the same server that PHP is running on), there needs to be an entry in your MySQL grant table that says that <user> (where <user> is your username) is allowed to connect. For reference, see 4.3.1 GRANT and REVOKE Syntax.
swirlee you rock....

i used the myslq_error function and it tells me that I do not have are the man..thanks... I must have to do the grant thing you mentioned...very good m8.
You can also stop certain users connecting from other places other than localhost. So make sure the user you are using can connect from any host.