[SQL SERVER] Connection to SQL Server from classic ASP (ok)

https://app.gitbook.com/@windows/s/windows10/connection-to-sql-server-from-classic-asp-ok

Download dll

C:\xampp\php\ext

Làm theo cái này chuẩn

Tải ở đây https://docs.microsoft.com/en-us/sql/connect/php/download-drivers-php-sql-server?view=sql-server-ver15

extension=php_sqlsrv_74_ts_x64.dll
extension=php_pdo_sqlsrv_74_ts_x64.dll

C:\xampp\php\php.ini

file php

<?php
$serverName = "LIONEL"; //serverName\instanceName

// Since UID and PWD are not specified in the $connectionInfo array,
// The connection will be attempted using Windows Authentication.
$connectionInfo = array(
	'Database'=>'TutorialDB',
	'UID'=>'test', 
	'PWD'=>'lionel123'
);
$conn = sqlsrv_connect( $serverName, $connectionInfo);

if( $conn ) {
     echo "Connection established.<br />";
}else{
     echo '<pre>';
     	var_export(sqlsrv_errors());
     echo '</pre>';
}
?>

Last updated