search
Homephp教程php手册php如何与mssql数据库连接与配置

PHP自带的扩展php_mssql.dll连接SQL Server 2000,用mssql系列函数来操作,和操作MySQL的一样.

1、打开PHP配置文件php.ini,找到;extension=php_mssql.dll把前面的分号去掉.

2、找到mssql.secure_connection = Off修改成 mssql.secure_connection = On。

3、把PHP文件夹下的php_mssql.dll和ntwdblib.DLL这两个文件拷贝到C:windowssystem32文件夹下.

4、重启Apache,OK

php用mssql_connect,代码如下:

<?php
$conn = mssql_connect(&#39;localhost&#39;, &#39;pandao&#39;, &#39;1987&#39;) or die(&#39;111cn.net数据库连接不上&#39;);
mssql_select_db(&#39;test&#39;, $conn);
//query语句
$Query = "select * from news";
$AdminResult = mssql_query($Query);
//输出结果
$Num = mssql_num_rows($AdminResult);
for ($i = 0; $i < $Num; $i++) { //开源代码phprm.com
    $Row = mssql_fetch_array($AdminResult);
    echo ($Row[1]);
    echo ("<br/>");
}


本文地址:

转载随意,但请附上文章地址:-)

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools