$ localhost = '127.0.0.1'; / / mssql database ip
$ sa = 'sa'; / / mssql login user name
$ pwd = '123'; / / connection password
$ db = 'cs'; // database
$ conn = mssql_connect ($ localhost, $ sa, $ pwd) or die ('mssql database connection failed');
mssql_select_db ($ db, $ conn); / / Select the operation of the database and mysql tutorial is the same
// query statement
$ query = "select * from vc";
$ adminresult = mssql_query ($ query) or die ('sql'. $ query);
// output the result
while ($ rs = mssql_fetch_array ($ adminresult))
{
echo $ rs ['0'];
} / *
Precautions
1, open the php.in extension = php_mssql.dll comment symbol removed.
Open php.in Change mssql.secure_connection = off to on.
3, php_mssql.dll copy to php.in extension_dir specified directory or system32 directory. (php_mssql.dll in the php compression installation package).
After the above steps need to restart apache.
Note: In actual use, if you manually install php to iis via php tarball, you must reboot the machine and not just iis.
4, Need to ensure that there is ntwdblib.dll php system or system32, check the properties to ensure that the version is 8.00.194 instead of 7.0