Are there any differences in specifying the path to a database between MySQL and MSSQL in PHP?

When specifying the path to a database in PHP, there are differences between MySQL and MSSQL. MySQL uses a hostname, username, password, and database name in the connection string, while MSSQL uses a server name, username, password, and database name. It is important to ensure that the correct parameters are used when connecting to the respective databases in PHP.

// For MySQL database connection
$servername = "localhost";
$username = "username";
$password = "password";
$database = "dbname";

$conn = new mysqli($servername, $username, $password, $database);

// For MSSQL database connection
$servername = "serverName";
$username = "username";
$password = "password";
$database = "dbname";

$conn = new PDO("sqlsrv:Server=$servername;Database=$database", $username, $password);