Issue
My MySQL server is running on one PC(xampp).I want to insert data into the MySQL database(remote PC) using PHP script from another PC(client).I have made a website using HTML5 and CSS(client).As PHP runs on server,how do I connect to remote PC using a simple webpage?
Solution
You can connect to a mysql database from anywhere using php. Just change the location to point to the remote server.
$servername = "ip_of_remote_server";
$username = "username";
$password = "password";
// Create connection
$conn = new mysqli($servername, $username, $password);
But you have to configure the mysql server to allow remote connections if you are using the root user. See: How to allow remote connection to mysql
Answered By - DustinPianalto
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.