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

下面要来告诉各位朋友php连接mssql数据库并且与php mssql配置方法,这样如果你是初学者这文章可以让你从配置mssql 到让php连接mssql数据库的.

php连接mssql数据库,代码如下:

$localhost ='127.0.0.1';//mssql数据库ip 
$sa ='sa';//mssql登录用户名 
$pwd='123';//连接密码 
$db = 'cs';//数据库 
$conn=mssql_connect($localhost,$sa,$pwd) or die('mssql数据库连接失败'); 
mssql_select_db($db,$conn);//选择操作的数据库与mysql教程是相同的 
//query语句   
$query="select * from vc"; 
$adminresult=mssql_query($query) or die('sql'.$query); 
//输出结果 
while( $rs = mssql_fetch_array( $adminresult ) ) 
{
    echo $rs['0']; 
}

注意事项

1、打开php.in将extension=php_mssql.dll的注释符号去掉.

2、打开php.in将mssql.secure_connection = off改为on.

3、将php_mssql.dll拷贝到php.in中extension_dir 指定的目录或者系统system32目录下,php_mssql.dll在php压缩安装包中有.

以上步骤完成后需要重启apache.

注意:实际使用中发现如果通过php压缩文件手工安装php到iis下,必须重启机器而不仅仅是iis.

4、需要保证php或者系统系统system32下有ntwdblib.dll,查看属性确保其版本为8.00.194而不是7.0.


本文地址:

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

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use