I have been using the localhost and had great success; however, I am now using a web domain.
I am used to using the following connection command:
$con = mysql_connect("localhost","username","password");
What would it be if my web domain was "www.mysite.com"?
Would it be:
$con = mysql_connect("www.mysite.com","username","password");
Real simple question, but I have had no luck, so thank you for any help!
Real quick and Easy Question: What is the servername?
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Real quick and Easy Question: What is the servername?
The name 'localhost' is how you refer to the server on which the application is running. Domain names like you show are for referencing other servers.
(#10850)
Re: Real quick and Easy Question: What is the servername?
Thank you for your response.
Yes, I am aware of that, but what would the connection string look like?
Yes, I am aware of that, but what would the connection string look like?
-
nowaydown1
- Forum Contributor
- Posts: 169
- Joined: Sun Apr 27, 2008 1:22 am
Re: Real quick and Easy Question: What is the servername?
You should check with your webhost. Look through their FAQ pages. They normally have information available about the database hostname that you should connect to. It might be localhost, or it might be somethink like 'db1.somehost.com'. Every hosting provider will be different.
Re: Real quick and Easy Question: What is the servername?
Thank you all for your posts! I simply was of the impression that "localhost" was only for your personal computer. Apperantly, it works on the web too...go figure...never would have guessed.
Re: Real quick and Easy Question: What is the servername?
Yes it would remain localhost as normal webhosts have the sql server on the same server; its only when its a seperate server do you have to specify something other than localhost.