How to use PHP to connect to sql server

前端 未结 14 2107
醉梦人生
醉梦人生 2020-11-30 11:37

I want to use PHP to connect to sql server database.

I installed xampp 1.7.0(php 5.2) and SQLSRV20. I\'ve added the extensions in php.ini and I get thi

14条回答
  •  心在旅途
    2020-11-30 11:56

    for further investigation: print out the mssql error message:

    $dbhandle = mssql_connect($myServer, $myUser, $myPass) or die("Could not connect to database: ".mssql_get_last_message()); 
    

    It is also important to specify the port: On MS SQL Server 2000, separate it with a comma:

    $myServer = "10.85.80.229:1443";
    

    or

    $myServer = "10.85.80.229,1443";
    

提交回复
热议问题