Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to connect to external db?

Status
Not open for further replies.

gojira2005

Technical User
Mar 8, 2005
1
GB
This is bound to be embarassingly simple!

I have a mysql database hosted on one of sites. I would like another of my sites to link to it.

However, I cannot make a connection!

The code I am using is as follows:

Code:
 $connection=mysql_connect("[URL unfurl="true"]http://localhost.sitename.biz","username","password")[/URL]       or die("Cannot connect to mysql server");

this is the first time I have done this so please be gentle on me! Thanks.
 
the HOST parameter takes in either an IP address or DNS name of the target. Http:// is a protocol specifier that is for browsers use; it is not part of the hostname. If your hostname is localhost.sitename.biz, just put that there. Make sure you can resolve it with DNS. If not, but it in the DNS. If you can't, just put the IP instead. Either way, get rid of * :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top