我正在运行以下查询:
$sql_1 = "SELECT `mb_transactions`.`TransactionID` AS `TXID` FROM `mb_transactions`";
$data_1 = $db->query($sql_1);
$count = count($data_1, COUNT_RECURSIVE);
if ($count > 1){
foreach ($data_1 as $transaction_1) {
$pdf->Cell($colWidths4[0], $pdf->fontHeight($fontSize), $transaction_1['TXID'], $border, 0, 'L');
$pdf->Cell($colWidths4[1], $pdf->fontHeight($fontSize), '', $border, 0, 'L');
$pdf->Cell($colWidths4[2], $pdf->fontHeight($fontSize), '', $border, 0, 'L');
$pdf->Cell($colWidths4[3], $pdf->fontHeight($fontSize), '', $border, 0, 'L');
$pdf->Ln();
}
}
但是我只从显示的结果中获得第一个字符。当我做var_dump($ transaction_1)时,我看到字符串(2)“11”......等等 欣赏任何人关心分享的见解
答案 0 :(得分:3)
为每个
尝试此操作while ($data = $data_1->fetchRow(DB_FETCHMODE_ASSOC)) {
}