Tuesday, July 28, 2009

How do I incorporate MySQL and PHP into my website domain?

All the queries and mysql connections work fine on my computer as localhost. What should be changed in this line: $mysqli = new mysqli("localhost", "root", null, "portfolio"); if I want to connect the database to my web domain?





Currently using wamp server with phpmyadmin. What steps should I take so that the queries in my codes work when uploaded to the website server?

How do I incorporate MySQL and PHP into my website domain?
Do you mean accessing the MySQL server in a remote host?





From "mysqli", replace "localhost" with the URI of your host, say "http://www.yourwebsite.com"





However, that will only work if you've configured the MySQL server of your host to allow remote access, especially requests coming from your IP address.





How you're to do that depends on your hosting service. But if they're using cPanel, the utility will be in the "MySQL Databases" item and the form you need is at the bottom of the page.





If the question is, "will the same code work once uploaded"; then it should because once uploaded, "http://www.yourwebsite.com" is the "localhost".
Reply:Well, you'd best consult your host provider, and make sure PHP and MySQL is supported by the host.. you basically have to change "localhost" to the appropriate server name like example.com, It really doesn't differ much from local versions, you just have to indicate the proper server name and configuration settings, like root directories and stuff.
Reply:You need to be using a hosting package that includes PHP and MSQL. The connection settings will depend on the host, so you'll have to check with their instructions.


No comments:

Post a Comment