Jump to content
xisto Community
darran

How Do I Connect To Live Database With Php Script? while being hosted with ComputingHost

Recommended Posts

I am not new to programming.I want to create a form to add some values into my tables, the code are all working. But I am not sure what is the URL to connect to my site's database. All along, I have been testing through MAMP, which provides a local copy of mySQL.Can anyone lend me a hand?

Edited by darran (see edit history)

Share this post


Link to post
Share on other sites

Use 'localhost' and that should be fine.Database name, User name and password, too, of course.

Share this post


Link to post
Share on other sites

If you upload the files to your hosting account then you need to use localhost as the server name. 'Localhost' simply means 'this computer'. So, if the actual files using the database are on the same computer as the database itself, then the server name is 'localhost'. However, if you want to keep the files on your machine, but use the Xisto database, then you need a remote connection. Unfortunately I don't think Xisto allows them.

Share this post


Link to post
Share on other sites

The database on your local machine and the one on Xisto are handled separately by their respective servers. Your Xisto account already has a default account setup for you I believe and so does the MySQL database on your local machine. Their user names and access will be different so you should configure your local MySQL to have user name and databases exactly as how you have it in Xisto. This way you can work on one version and upload it to Xisto and it should work fine since both user name and passwords are identical. The only thing you have to do is make sure your database structure stays the same on both servers.

Share this post


Link to post
Share on other sites

I think we have somehow strayed away from my initial question but I appreciate the feedback nonetheless. So do you mean to say that if I am using the SQL tables and database on my Xisto - Web Hosting account, I just need to use 'localhost' and there isn't any remote IP address I need to use? All along in my programming assignments, I have been used to connecting remotely to the server. In any case, thanks for letting me in on this minor detail.

Share this post


Link to post
Share on other sites

Yes because the file site on the server you will use 'localhost' to refer to itself. Xisto wont allow you to connect remotely ie. running the php file on your machine at home and trying to connect to your Xisto mysql account. Same for your local machine it will only work locally(unless you configure it to accept remote connections which I think is possible but not recommended).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.