在php连接mssql时查询出来的全部是乱码,这种问题我根据经验知道是编码问题,下面来给各位总结一下解决方法.
;mssql.charset = "ISO-8859-1"
mssql.charset = "GBK"
");
//printaline("PLEASE?");
//print("This will not be displayed due to the above error.");
?>
$conn = new COM("ADODB.Connection", NULL, CP_UTF8) or die("Cannot start ADO");
//access 数据库的打开方式
//$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db");
//$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db");
$conn->Open("Driver={SQL Server};Server={192.168.22.40};Database=sugarcrm_db;UID=sa;PWD=123456;") ;
// 执行查询并输出数据
$rs = $conn->Execute('SELECT * FROM accounts') or die ("error query");
?>