时间:2021-07-01 10:21:17 帮助过:13人阅读
代码如下:
$serverName = "127.0.0.1";
$connectionInfo = array("Database"=>"TestDB","UID"=>"test","PWD"=>"test");
$conn = sqlsrv_connect($serverName, $connectionInfo);
if($conn) {
echo "Connection established.
";
} else {
echo "Connection could not be established.
";
die(print_r(sqlsrv_errors(), true));
exit();
}
$sql = "select * from T_Employee";
$result = sqlsrv_query($conn,$sql);
$data = array();
while($row=sqlsrv_fetch_array($result)) {
$data[] = $row;
}
foreach($data as $p) {
echo $p['Name']."
";
}
sqlsrv_close($conn);
echo "
Done
";
echo date("Y-m-d h:i:s");
?>
以上就介绍了mssql2005 php下连接mssql2005的代码,包括了mssql2005方面的内容,希望对PHP教程有兴趣的朋友有所帮助。