HOME       >>       Programming

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


darran

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?


jlhaslip

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


darran

I want to be able to connect to my site's database and not my local one. Does localhost apply to my site's database connection as well?


rvalkass

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.


sonesay

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.


darran

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.


sonesay

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).



VIEW DESKTOP VERSION REGISTERGET FREE HOSTING

Xisto.com offers Free Web Hosting to its Members for their participation in this Community. We moderate all content posted here but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2001-2019 by Xisto Corporation. All Rights Reserved.