Php mssql operations

Source: Internet
Author: User
Php operation mssql $ conn = @ mssql_connect ("127.0.0.1", "sa", "database") or die ("connection error ");

Mssql_select_db ("test") or die ("no such database ");

$ SQL = "select * from login ";

$ Result = mssql_query ($ SQL );

While ($ row = mssql_fetch_assoc ($ result ))
{
Echo $ row ['id']. "". $ row ['user']."
";

}


Mssql_close ($ conn );
// ================================================ ================================
Connecting SQL Server with PHP

Modify php. ini
1. remove the; sign before extension = php_mssql.dll.
2. confirm that extension_dir is the correct path. take the local machine as an example: extension_dir = "C: \ php \ extensions"

OK, restart the server and test ing...

If not, try the following method:

PS: I have passed the test on several computers, but I reported an error on my machine saying that c: \ php \ extensions \ php_mssql.dll could not be found, but this file exists clearly.

Solution:
Put php_mssql.dll and ntwdblib. dll in the system directory \ system32 and restart the test...

(Note: The above two dll files are not in the same directory. Please search for them yourself. ^ _____ ^)

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.