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