$db_a = new PDO("odbc:MYOB",'user','pass');
foreach($db_a->query("SELECT * FROM Sale WHERE SaleID = 108605") as $row) {
echo '<pre>';
print_r($row);
echo '</pre>';
}
这将返回所有表列标题以及前五个结果,但之后的所有内容均为空白。我尝试过通过MS访问发出相同的select语句,它可以正常工作
Array
(
[ItemSaleLineID] => 1605696
[0] => 1605696
[SaleLineID] => 1605696
[1] => 1605696
[SaleID] => 108605
[2] => 108605
[LineNumber] => 1
[3] => 1
[LineTypeID] => D
[4] => D
[Description] =>
[5] =>
[TaxExclusiveTotal] =>
[6] =>
[TaxInclusiveTotal] =>
[7] =>
[TaxCodeID] =>
[8] =>
[JobID] =>
[9] =>
[IsMultipleJob] =>
[10] =>
[Quantity] =>
[11] =>
[ItemID] =>
[12] =>
[TaxExclusiveUnitPrice] =>
[13] =>
[TaxInclusiveUnitPrice] =>
[14] =>
[Discount] =>
[15] =>
[CostOfGoodsSoldAmount] =>
[16] =>
[LocationID] =>
[17] =>
[Kit/ComponentIndicator] =>
[18] =>
)
var_dump的输出:
array(20) { ["SaleLineID"]=> string(7) "1605696" [0]=> string(7) "1605696" ["SaleID"]=> string(6) "108605" [1]=> string(6) "108605" ["LineNumber"]=> string(1) "1" [2]=> string(1) "1" ["LineTypeID"]=> string(1) "D" [3]=> string(1) "D" ["Description"]=> NULL [4]=> NULL ["TaxExclusiveAmount"]=> NULL [5]=> NULL ["TaxInclusiveAmount"]=> NULL [6]=> NULL ["TaxCodeID"]=> NULL [7]=> NULL ["JobID"]=> NULL [8]=> NULL ["IsMultipleJob"]=> NULL [9]=> NULL } array(20) { ["SaleLineID"]=> string(7) "1605697" [0]=> string(7) "1605697" ["SaleID"]=> string(6) "108605" [1]=> string(6) "108605" ["LineNumber"]=> string(1) "2" [2]=> string(1) "2" ["LineTypeID"]=> string(1) "D" [3]=> string(1) "D" ["Description"]=> NULL [4]=> NULL ["TaxExclusiveAmount"]=> NULL [5]=> NULL ["TaxInclusiveAmount"]=> NULL [6]=> NULL ["TaxCodeID"]=> NULL [7]=> NULL ["JobID"]=> NULL [8]=> NULL ["IsMultipleJob"]=> NULL [9]=> NULL } array(20) { ["SaleLineID"]=> string(7) "1605698" [0]=> string(7) "1605698" ["SaleID"]=> string(6) "108605" [1]=> string(6) "108605" ["LineNumber"]=> string(1) "3" [2]=> string(1) "3" ["LineTypeID"]=> string(1) "D" [3]=> string(1) "D" ["Description"]=> NULL [4]=> NULL ["TaxExclusiveAmount"]=> NULL [5]=> NULL ["TaxInclusiveAmount"]=> NULL [6]=> NULL ["TaxCodeID"]=> NULL [7]=> NULL ["JobID"]=> NULL [8]=> NULL ["IsMultipleJob"]=> NULL [9]=> NULL }