PHP MSSQL extension

user-pic
Vote 0 Votes

要先裝 FreeTDS
PHP configure 時加 --with-mssql
編輯 /usr/local/etc/freetds.conf

[mssql]
host = your_mssql_server
port = 1433
client charset = cp950
tds version = 8.0

MSSQL 2000 以上 tds version 可以用 7.0 或 8.0, 我用 MSSQL 2005, tds version = 8.0 沒問題.
可以先用 tsql -S servername -U username -P password 作測試,
servername 是 freetds.conf 裡訂的識別字串(本例是 mssql)
PHP 程式內用
mssql_connect('mssql','username','password'); // 這邊和 mysql_connect 不同, 第一個參數是 servername, 參照 freetds.conf
mssql_select_db('your_db'); // 某些狀況此步驟可省略
其他的 mssql functionmysql 的大同小異.

Leave a comment

About this Entry

This page contains a single entry by Pank published on June 28, 2006 12:57 AM.

WikiMapia was the previous entry in this blog.

Certification is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Monthly Archives