(转)php5.3中的连接MSSQLSERVER(非PDO方式)
来源:互联网 发布:数据交换共享平台源码 编辑:程序博客网 时间:2024/06/03 20:16
说了这么多乱七八糟的话,言归正传:
我的系统环境:
win2003 sp2
本机安装了mssql2000
PHP5.3.6
IIS6.0
FastCGI安装方式安装的PHP
?
在网上找了很多的方式都不可以,用什么php_mssql.dll 之类的,从php5.2.X 到 php5.3.X 都做了测试,
全不解决问题,而且可能报出各种错误,总的来说在页面上的显示是 undefine function 的定义!
还在官方网站上找到了解决方法:
下载一个另一个组件: php_dblib.dll 就可以解决问题!
将php_dblib.dll到ext文件夹下, 并在php.ini文件里加入 extension=php_dblib.dll
这里要注意一下这个dll文件不要搞错了,我刚开始是用的Thread Safe 的版本,测试不成功,
因为我的php是用的 not Thread Safe 版, 所以应该选择 not Thread Safe 版的dll下载就可以了.
重启IIS, 测试通过!
?
$server='127.0.0.1:1433';
$username='sa';
$password='000000';
mssql_connect($server,$username,$password);
?
mssql_select_db('数据库名');
?
$sql="select * from 表名";
$rows=mssql_query($sql);
?
while($rs=mssql_fetch_assoc($rows)){
echo $rs['name']."<br>";
}
$sql="insert 表名(name) values('中国130123456')";
$rows=mssql_query($sql);
?
参考页面:
http://docs.moodle.org/en/Installing_MSSQL_for_PHP#Using_the_SQL_Server_2005_Driver_for_PHP_from_Microsoft_on_Windows
?
Using FreeTDS on Windows
Important Note 1: Due to some previous bugs it's highly recommendable to use PHP >= 5.2.6 and FreeTDS 0.82 + post-release patches (more info).
If your web server is on Windows, use php_dblib.dll. Despite the name, it's FreeTDS compiled for Windows. (Go to this page for information on Using FreeTDS for Unix.)
Originally we were using the DLLs available at Frank Kromann's site, but they are outdated (using old versions of FreeTDS) and that has caused some problems in the past.
So, right now, the recommended way to use FreeTDS under Windows is to use PHP 5.2.x following the following instructions:
1. Download the appropriate copy of php_dblib.dll from the list below, and save it into your /PHP/ext directory.
(alternatively here you can find some instructions to build those freetds extensions under win32yourself)
2. FreeTDS requires the .NET Framework v1.1 to be installed. You can download it from the Microsoft website along with its service pack. Alternatively, if you do not wish to install this framework, you can download the required DLL from Frank's site, and save it into your /PHP root directory.
?
转自:http://hi.baidu.com/zwfec/blog/item/3c54a3ec57c4433063d09f1e.html
- (转)php5.3中的连接MSSQLSERVER(非PDO方式)
- (转)php5.3中的连接MSSQLSERVER(非PDO方式)(php_dblib.dll) 解决方法
- PHP5.2/PHP5.3以PDO方式链接MSSQL2000/2005
- php5中的PDO
- ThinkPHP使用PDO方式连接数据库之PDO的介绍与安装,开发环境是PHP5
- PHP5中使用PDO连接数据库
- PHP5使用PDO连接MySQL数据库 详解
- php5.4之pdo连接sqlserver
- mysql 之PDO连接方式
- 【转】PHP5中PDO的简单使用
- PHP5中PDO的简单使用(转)
- 如何在PHP5中通过PDO连接SQLite3数据库
- PHP5中PDO的简单使用 连接数据库
- PHP5中使用PDO连接数据库的方法
- php连接mysql类PDO从php5才开始有
- PHP5中使用PDO连接数据库的方法
- PHP5中使用PDO连接数据库的方法
- PHP5中使用PDO连接数据库的方法
- jquery Easy UI怎么让datagrid显示+号
- hybridapp微博登陆从零到实现
- iOS相机相册调用 — UIImagePickerController
- Java多线程(1) 创建
- hdoj 1220Cube
- (转)php5.3中的连接MSSQLSERVER(非PDO方式)
- lightoj 1425 - The Monkey and the Oiled Bamboo 二分答案or乱搞
- Majority Element
- 关于大型网站技术演进的思考(五)--存储的瓶颈(5)
- Linux自动清理日志
- Android 代码混淆总结
- android6.0 adbd深入分析(一)adb驱动初始化、读取adb节点线程
- 苹果所有常用证书,appID,Provisioning Profiles配置说明及制作图文教程(精)
- linux find