Php connects to the mssql database program. Php provides commands for directly connecting to the mssql database, just like connecting to mysql. I will introduce them below. The following is the odbc Connection creation code. The code is as follows: Copy the code $ conodb php to provide commands for directly connecting to the mssql database, just like connecting to mysql. I will introduce it below.
The following is the odbc Connection creation code.
| The code is as follows: |
|
|
$ Con = odbc_connect ('odbc name', 'username', 'password '); |
2. connect to mssql2000
| The code is as follows: |
|
|
$ Con = mssql_connect ('database address', 'username', 'password '); |
3. connect to mssql2008
| The code is as follows: |
|
|
$ ConnectionInfo = array ("UID" => username, "PWD" => password, "Database" => "Database name ");
$ Con = sqlsrv_connect (database address, $ connectionInfo ); |
The above method is simple and I will not introduce it. it only describes the settings (php. ini file) if the connection fails.
Medium; extension = php_pdo_mssql.dll; remove the semicolon before extension = php_pdo_odbc.dll)
Bytes. The following is the odbc Connection creation code. The code is as follows $ con = odb...