php provides commands to directly connect to the mssql database, just like connecting to mysql. I will introduce it below.
The following is the odbc connection establishment code.
The code is as follows
代码如下 |
复制代码 |
$con = odbc_connect('odbc名称','用户名','密码');
|
|
Copy code
|
代码如下 |
复制代码 |
$con = mssql_connect('数据库地址','用户名','密码');
|
$con = odbc_connect('odbc name','username','password');
代码如下 |
复制代码 |
$connectionInfo = array("UID"=>用户名,"PWD"=>密码,"Database"=>"数据库名称");
$con = sqlsrv_connect( 数据库地址,$connectionInfo);
|
2. Connect mssql2000
The code is as follows
|
Copy code
|
| $con = mssql_connect('database address', 'username', 'password');
3. Connect mssql2008
The code is as follows
|
Copy code
|
$connectionInfo = array("UID"=>Username,"PWD"=>Password,"Database"=>"Database Name");
$con = sqlsrv_connect(database address,$connectionInfo);
The above method is very simple and I won’t introduce it. I will only tell you that if the connection is unsuccessful, we can make the following settings (php.ini file
;extension=php_pdo_mssql.dll;extension=php_pdo_odbc.dllRemove the semicolon in front)
http://www.bkjia.com/PHPjc/630727.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630727.htmlTechArticlephp provides commands to directly connect to the mssql database, just like connecting to mysql. Let me introduce it below . The following is the odbc connection establishment code. The code is as follows Copy code $con = odb...
|
|