Php connection mssql database configuration and demo code

Source: Internet
Author: User
Open the PHP configuration file php. ini, find; extensionphp_mssql.dll, remove the semicolon, 2. find mssql. change secure_connectionOff to mssql. se... open the PHP configuration file php. ini, find; extension = php_mssql.dll, remove the semicolon, 2. find mssql. secure_connection = Off to mssql. secure_connection = On, 3. set php_mssql.dll and ntwdblib in the PHP folder. DLL files are copied to the C: windowssystem32 folder.

Here, copying ntwdblib. dll to c: windowssystem32 fails because the dll file already exists in the directory. restart apache.

$ Hostname = "10.4.250.20"; $ dbuser = "hr"; $ dbpasswd = "946138"; $ dbname = "hr"; $ conn = mssql_connect ($ hostname, $ dbuser, $ dbpasswd) or die ("database connection error! "); Mssql_select_db ($ dbname, $ conn); $ SQL =" select * from pip_staff_s where cstaffid = 'z797 '"; $ rowset = mssql_query ($ SQL, $ conn ); $ rowcnt = mssql_num_row ($ rowset); echo "rows"; echo $ rowset; echo "end ";

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.