PHP after the 5.3 version of the interaction with the MSSQL changes, the original MSSQL function system is no longer supported, the use of the SQLSRV function provided by Microsoft, using the SQLSRV function required by Microsoft to provide the Dynamic function library SQL Server Driver for PHP.
Download the library from the official Microsoft website and load the library in the php.ini file to use the library's API
Currently the official library version only supports php5.4 and the following versions, the php5.5 is not supported temporarily, if required php5.5 version can use unofficial compiled version.
The following is an example of how PHP uses the SQLSRV function to interact with MSSQL data:
<?PHP/*$serverName Specifies the name of the server to which you want to connect, including the instance name (for example, "Myserver\instancename") common default values (local), 127.0.0.1, Localhostsqlsrv_connect Opening a database connection requires two parameters (the second parameter is in the form of an array) sqlsrv_errors output error message sqlsrv_close close connection*/$serverName= "(local)";$connectionInfo=Array("Database" = "AdventureWorks", "UID" = "sa", "PWD" = "123456"");$conn= Sqlsrv_connect ($serverName,$connectionInfo);if($conn ){ Echo"Connection established.\n";}Else{ Echo"Connection could not being established.\n"; die(Print_r(Sqlsrv_errors (),true));}/*Close the connection.*/Sqlsrv_close ($conn);?>