I am very sorry yes I know this has been asked before but when I look at the post it looks like I am doing everything right yet it isn't working.
So I want to make a sql insert only if that $domain does not exist in the database, I don't mind if multiple domains have the same IP.
Here is my current sql query which doesn't add any domains and IPs to the database.
mysql_query("INSERT INTO domains (domain, ip) VALUES ('$domain', '$ip') WHERE NOT EXISTS (SELECT FROM domains where domain='$domain')");