php connect mssql database and configuration method

Source: Internet
Author: User
Keywords Network programming PHP tutorial
Tags configuration connect failed ip login name network network programming

$ 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.