轻松搭建PHP5和SQL Server 2005开发环境

SQL Server 2005 php驱动是php5的一个扩展,它提供访问SQL Server 2005和SQL Server 2000.该扩展数据访问接口可以应用在所有版本(包括体验版)的SQL Server 2005和SQL Server 2000.该SQL Server 2005 php驱动支持Windows验证,参数绑定(译预处理),大对象流,原数据访问和错误处理.

在你使用IIS:Internet Information Services和FastCGI组件,该驱动拥有良好的性能和稳定的Windows平台.
关于FastCGI组件可访问:FastCGI for IIS.

访问http://blogs.msdn.com/sqlphp和SQL Server Data Access Forum对求支持和提供反馈

原文:

The SQL Server 2005 PHP Driver is a PHP 5 extension that provides data access to SQL Server 2005 and SQL Server 2000. The extension provides a procedural interface for accessing data in all versions (including Express) of SQL Server 2005 and SQL Server 2000. The SQL Server 2005 Driver for PHP API includes support for Windows Integrated Authentication, parameter binding, streaming of large objects, metadata access, and error handling.


The PHP Driver takes advantage of the improved performance and stability of PHP on the Windows platform when you are using Internet Information Services (IIS) and the FastCGI component. For more information about the FastCGI component, see FastCGI for IIS .


The functionality described and demonstrated in this document is a subset of the functionality planned for the final version of the SQL Server 2005 Driver for PHP and is subject to change. To provide feedback or find support, visit http://blogs.msdn.com/sqlphp or SQL Server Data Access Forum.

配置:

1.将php_sqlsrv.dll 或 php_sqlsrv_ts.dll 放到PHP的扩展目录中(PHP/EXT).
2.编辑php.ini文件,添加以下扩展:
extension=php_sqlsrv.dll

extension=php_sqlsrv_ts.dll
3.重启服务器.

示例:

 

<? php
$dbbase = ' testlab ' ;
$uid = ' sa ' ;
$pwd = ' infobus ' ;
$connectionInfo = array ( " Database " => $dbbase , " UID " => $uid , " PWD " => $pwd );
$serverName = " JUJUMAOEXPRESS " ;
if ( ! ( $conn = sqlsrv_connect( $serverName , $connectionInfo ))){
    
echo   " Connection could not be established. " ;
    
die ( print_r (sqlsrv_errors() , true ));
}
$tSQL = " SELECT login_mail FROM account " ;
if ( ! ( $stmt = sqlsrv_query( $conn , $tSQL ))){
    
echo   " Error in statement. " ;
    
die ( print_r (sqlsrv_errors() , true ));
}
if ( ! (sqlsrv_fetch( $stmt ))){
                    
echo   " Error in retrieving row. " ;
                    
die ( print_r (sqlsrv_errors() , true ));
}
$loginmail = sqlsrv_get_field( $stmt , 1 );
echo   $loginmail ;

sqlsrv_close(
$conn );
?>
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值