Not the way you have it written. You would have to set an IF/ELSE condition to determine which to connect to.
If ($somevariable == 'somevalue'):
$link = mysql_connect("ip", "mysql_user", "mysql_password");
Else:
$link = mysql_connect("ip2", "mysql_user", "mysql_password");
Endif;