Home  >  Article  >  Backend Development  >  PHP connection mssql database program_PHP tutorial

PHP connection mssql database program_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:05:591001browse

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

$con = mssql_connect('database address', 'username', 'password');
The code is as follows Copy code

3. Connect mssql2008
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn