If PHP and MySQL are connected, the link between PHP and MSSQL is actually very simple;
Local and remote connections of MSSQL are supported. Take the local link as an example:
Ms sqlserver 2005 is installed on the machine;
PHP needs to be configured:
1. First, ms SQL client tools is a DLL calledNtwdblib. dll, which is usually copied to the System32 folder of the system after ms SQL Server is installed. If SQL Server is installed locally, You need to verify thatThe ntwdblib. dll version is the same as the SQL Server version (2005 corresponds to 2000.80.194.0, 2000 corresponds to 2000.2.8.0;) if the SQL Server is remoteCopy ntwdblib. DLL to the System32 folder of the current machine;
(A common problem here is that if PHPNtwdblib. dll> If it is later than SQL Server installationNtwdblib. dll will overwriteNtwdblib. dll. The link is prompted: the database cannot be connected.)
2. VerifyAfter ntwdblib. dllNtwdblib. dll overwritesNtwdblib. dll;
3. the ms SQL Server method is similar to that of MySQL;
As follows:
// Link to the database
$ Conn = mssql_connect ('ibm-f24b11ed1ccsqlexpress ', 'sa', '123 ');
Mssql_select_db ('labmis ', $ conn );
// Query statement
$ Query = "select * from admin ";
$ Adminresult = mssql_query ($ query );
// Output result
$ Num = mssql_num_rows ($ adminresult );
For ($ I = 0; $ I {
$ ROW = mssql_fetch_array ($ adminresult );
Echo ($ row [1]);
Echo ("
");
}
?>
It can be seen that these functions and MySQL functions are corresponding for easy use!