0
我在PC上设置了Sage Line 50 ODBC驱动程序,并且在同一台机器上使用XAMPP php服务器来查询使用PHP的sage数据库。Sage 50 ODBC PHP编码问题
下面是一些基本的代码来询问销售台账表:
<?php
error_reporting(E_ERROR);
//attempt to connect to Sage Line 50 via the system DSN which is on the Sage Server
echo("Trying to connect to Sage<hr>");
if(isset($_REQUEST['account_ref']) && $_REQUEST['account_ref'] != "") {
$account_ref = $_REQUEST['account_ref'];
$odbc['dsn'] = "SAGE50";
$odbc['user'] = "manager";
$odbc['pass'] = "brand";
$conn = odbc_connect($odbc['dsn'], $odbc['user'], $odbc['pass']);
if (!$conn) {
die("Error connecting to the ODBC database: " . odbc_errormsg());
} else {
$obj = array();
echo("Connected<br>");
$query = odbc_exec($conn, "SELECT * FROM SALES_LEDGER where ACCOUNT_REF = '{$account_ref}'");
while ($row = odbc_fetch_array($query)) {
print_r($row);
}
}
} else {
return false;
}
现在,查询的实际工作和检索数据。然而,它大部分看起来都是垃圾,并且具有奇怪的字符而不是值。
例如:
Array (
[�������] => [] =>
[0] => 0
[Defaul] => Defaul
[Open] => Open
[T1] => T1
[4000] => 4000
[1] => 1
[GB] => GB
[0.00] => 0.00
[30] => 30
[2009-10-22] => 2009-10-22
[Good] => Good
[201x��201] => 201x��201
[201���0�] => 201���0�
)
任何人都可以提供关于为什么这可能发生的任何建议,也许,如果有这样做的更好的方法。
任何想法或经验都会受到欢迎。
问候
詹姆斯