Manage cookies that are used for advertising, such as ad personalization, remarketing, and ad effectiveness analysis.
2.8.21. Work with MS SQL
On the hosting, there are tools available for working with external Microsoft SQL Server (MS SQL) databases.
PHP 5.2-5.6
The Mssql extension is available by default.
PHP 7.0-8.4
Available modules:
Before using the extension on the site, it must be enabled in the list of extensions in the PHP settings. In the console and cron modules are available by default.
Connect to database
Using PDO:
$link = new PDO("sqlsrv:Server={$server};Database={$dbname}", $login, $passwd);
$link->query("select getdate()");
Using SQLSRV:
$link = sqlsrv_connect($server, ["Database"=>$dbname, "UID"=>$login, "PWD"=>$passwd]);
sqlsrv_query($link, "select getdate()");
The variables $server, $dbname, $login and $passwd should contain the MS SQL server host, database name, username, and password, respectively.