How can the user table in MySQL be modified to allow remote connections in PHP?

To allow remote connections to the MySQL user table in PHP, you need to grant remote access permissions to the user you are using to connect to the database. This can be done by modifying the user's host to '%' in the MySQL user table. This will allow the user to connect from any host.

// Connect to MySQL database with remote access
$servername = "localhost";
$username = "your_username";
$password = "your_password";
$dbname = "your_database";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

echo "Connected successfully";