1. Download the following two files into the PHP ext directory and System32
Php_sqlsrv_52_ts_vc6.dll (thread safe)
Php_sqlsrv_52_nts_vc6.dll (non-thread safe)
VC6 for APACHE,VC9 for IIS
2. Modify PHP.ini
Extension=php_sqlsrv_52_ts_vc6.dll
3. Download Sqlncli.msi, Microsoft Official can under
The prompt for installation is SQL Server 2008, but 2005 is also available.
4. Test code
Copy CodeThe code is as follows:
$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 being 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");
?>
http://www.bkjia.com/PHPjc/322822.html www.bkjia.com true http://www.bkjia.com/PHPjc/322822.html techarticle 1. Download the following two files into the PHP ext directory and System32 php_sqlsrv_52_ts_vc6.dll (thread safe) php_sqlsrv_52_nts_vc6.dll (non-thread safe) VC6 for Apache, Vc9 for IIS 2. modifying ph ...