Home > php教程 > php手册 > php连接mssql 数据库配置与演示代码

php连接mssql 数据库配置与演示代码

WBOY
Release: 2016-05-26 15:21:52
Original
1320 people have browsed it

打开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文件夹下

在这里,复制ntwdblib.dll到c:windowssystem32下是失败,原因是该目录下已经存在该dll文件啦.重启apache.

$hostname="10.4.250.20";   
$dbuser="hr";   
$dbpasswd="946138";   
$dbname="hr";   
$conn = mssql_connect($hostname,$dbuser,$dbpasswd) or die("数据库连接错误!");   
mssql_select_db($dbname,$conn);   
$sql = " select * from pip_staff_s where cstaffid ='z797' ";   
$rowset=mssql_query($sql,$conn);   
$rowcnt=mssql_num_row($rowset); 
echo " rows ";
echo $rowset; 
echo " end ";
Copy after login


Related labels:
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