Mateobus Posted July 15, 2006 Share Posted July 15, 2006 I am trying to connect to a different database that isnt on localhost. How do i do that?$hostname= "www.othersite.com";$database= "database"; $username= "username";$password= "password"; $db = mysql_connect($hostname, $username, $password) or die(mysql_error());is this right? Link to comment https://forums.phpfreaks.com/topic/14714-how-do-you-connect-to-a-server-thats-not-localhost/ Share on other sites More sharing options...
Drumminxx Posted July 15, 2006 Share Posted July 15, 2006 if this is a hosting provider then you will need to check with the provider for that info. Could be something like:mysql.PROVIDERNAME.comhowever, if your trying to connect to a whole other domain altogether, you probably will not be able to since most do not allow this. Link to comment https://forums.phpfreaks.com/topic/14714-how-do-you-connect-to-a-server-thats-not-localhost/#findComment-58698 Share on other sites More sharing options...
gewthen Posted July 15, 2006 Share Posted July 15, 2006 You will have to allow external mysql connection to the database you want to connect to. The configuration can only be done with root access. If you do not have it there is no other way. Ask your system adminstrator. If you use shared hosting you will need to ask your hosting company. It is likely that with shared hosting you will not be able to connect for security reasons. Link to comment https://forums.phpfreaks.com/topic/14714-how-do-you-connect-to-a-server-thats-not-localhost/#findComment-58722 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.