What are some best practices for migrating a PHP project from using MS Access to a Microsoft SQL Server database?

When migrating a PHP project from using MS Access to a Microsoft SQL Server database, it is important to update the connection settings in the PHP code to connect to the new database. This involves changing the database driver, host, username, password, and database name in the connection string. Additionally, it may be necessary to modify any SQL queries that are specific to MS Access syntax to be compatible with SQL Server syntax.

// Original MS Access connection settings
$driver = '{Microsoft Access Driver (*.mdb)}';
$db_path = 'C:\\path\\to\\database.mdb';
$conn_str = "DRIVER=$driver; DBQ=$db_path";

// New SQL Server connection settings
$server = 'localhost';
$database = 'new_database';
$username = 'username';
$password = 'password';
$conn_str = "sqlsrv:Server=$server;Database=$database";

// Connect to the SQL Server database
try {
    $conn = new PDO($conn_str, $username, $password);
    echo "Connected successfully";
} catch (PDOException $e) {
    echo "Connection failed: " . $e->getMessage();
}