Home > php教程 > php手册 > php连接mssql数据库程序

php连接mssql数据库程序

WBOY
Release: 2016-06-13 10:08:43
Original
1035 people have browsed it

php中提供了直接与mssql数据库连接的命令,就像是与mysql连接一样,下面我来介绍。

下面是odbc建立连接代码。

 代码如下 复制代码

$con = odbc_connect('odbc名称','用户名','密码');

2、连接mssql2000

 代码如下 复制代码

$con = mssql_connect('数据库地址','用户名','密码');

3、连接mssql2008

 代码如下 复制代码

$connectionInfo =  array("UID"=>用户名,"PWD"=>密码,"Database"=>"数据库名称");
$con = sqlsrv_connect( 数据库地址,$connectionInfo);

上面方法很简单我就不介绍了,只讲述如果连接不成功我们可做如下设置(php.ini文件

中;extension=php_pdo_mssql.dll ;extension=php_pdo_odbc.dll 前面的分号去掉)

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template