我需要在SQL Server和CMS中的记录之间编写同步。一切正常,但一些记录有奇怪的字符。
当我在SQL Management Studio中查找它时,我可以看到值“Anselm Gr ü n”。当我在PHP PDO中执行查询时,值为“NULL”
执行查询的PHP代码:
function getResultFromSqlServer($queryString){
$db = new PDO('odbc:Driver=ODBC Driver 11 for SQL Server; Server=****,1433; Database=Winbooks; UID=****; PWD=****');
$query = $db->query($queryString);
$result = array();
while ($row = $query->fetch()){
$result[] = $row;
}//while
return $result;
}//getResultFromSqlServer
查询:
SELECT name1 as 'Naam', insleep as 'Slapend',
c_webshop as 'Webshop', tr_groep as 'Groep',
tr_subgroe as 'Subgroep'
FROM art
WHERE (tr_subgroe LIKE '".$logisticsCode."%'
OR tr_groep LIKE '".$logisticsCode."%')
AND insleep = 0
ORDER BY name1
(我知道我应该使用预备语句,但这仅用于测试目的)
非常感谢提前!
答案 0 :(得分:0)
尝试使用unicode搜索
SELECT name1 as 'Naam', insleep as 'Slapend',
c_webshop as 'Webshop', tr_groep as 'Groep',
tr_subgroe as 'Subgroep'
FROM art
WHERE (tr_subgroe LIKE N'".$logisticsCode."%'
OR tr_groep LIKE N'".$logisticsCode."%')
AND insleep = 0
ORDER BY name1