Jump to content


Photo

how do you connect to a server thats not localhost?


  • Please log in to reply
2 replies to this topic

#1 Mateobus

Mateobus
  • Members
  • PipPipPip
  • Advanced Member
  • 95 posts

Posted 15 July 2006 - 10:00 PM

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?

#2 Drumminxx

Drumminxx
  • Members
  • PipPipPip
  • Advanced Member
  • 92 posts
  • LocationUSA

Posted 15 July 2006 - 10:17 PM

if this is a hosting provider then you will need to check with the provider for that info. Could be something like:
mysql.PROVIDERNAME.com

however, if your trying to connect to a whole other domain altogether, you probably will not be able to since most do not allow this.
:: gucci.com ::
:: blockbuster.com ::

--------------------

#3 gewthen

gewthen
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 15 July 2006 - 11:45 PM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users