PHP利用 mssql 扩展连接MSSQL,这里给一个简单的示例,没有做安全考虑,自行处理吧
代码如下
// 连接数据库
$conn = mssql_connect("hostip:1433","user","pass") or die("SQL SERVER 数据库连接失败!");
// 选择数据库
mssql_select_db("UserInfo", $conn);
// sql语句
$sql = "SELECT TOP 5 * FROM info";
$result = mssql_query($sql);
//打印输出
//print_r($result);
$num = mssql_num_rows($result);
echo "有".$num."条记录
";
if($num){
//循环出每一条记录
for( $i=0;$i<$num;$i++ ){
$Row = mssql_fetch_array($result);
echo $Row[0].$Row[1]."...
";
}
}else{
echo "暂无数据" ;
}
//关闭连接
mssql_close($conn);
?>
php扩展 c|PHP扩展 mssql 连接远程 MSSQL的例子
http://m.bbyears.com/shujuku/104161.html
推荐访问:php扩展memcached php编写c扩展 php常用扩展名 php扩展下载 php扩展有哪些