1
2<?php
3$serverName = "serverName\\sqlexpress"; //serverName\instanceName
4
5// Since UID and PWD are not specified in the $connectionInfo array,
6// The connection will be attempted using Windows Authentication.
7$connectionInfo = array( "Database"=>"dbName");
8$conn = sqlsrv_connect( $serverName, $connectionInfo);
9
10if( $conn ) {
11 echo "Connection established.<br />";
12}else{
13 echo "Connection could not be established.<br />";
14 die( print_r( sqlsrv_errors(), true));
15}
16?>
17
18