0
我想在我的pdf中添加一个自动递增的序列号列。我试图从数据库中获取它,但由于检索的数据是随机的,因此印在PDF上的序列号也是随机的。我想开始它像1,2,3 ...FPDF-如何在列中提供自动递增的序列号?
$sql2 = "SELECT * FROM `" . $DB->pre . "order_detail`
WHERE orderID= '$orderID'";
$rows2 = $DB->dbRows($sql2);
if ($DB->numRows > 0){
$pdf->SetLineWidth(0);
$pdf->SetFont('Arial','',10);
$newL=110; ////fixed cell spaced in y-axis for quantity
$cnt=0;
foreach ($rows2 as $d2) {
$rows2++;
$pdf->SetXY(11,$newL);
$pdf->Cell(11,7, ,1,0,'L',0); /////SERIAL NUMBER COLUMN/////
$pdf->SetXY(22,$newL);
$pdf->Cell(22,7,$d2['materialDesc'],1,0,'L',0);
$pdf->SetXY(44,$newL);
$pdf->Cell(15,7,$d2['chart'],1,0,'L',0);
$pdf->SetXY(59,$newL);
$pdf->Cell(25,7,$d2['shade'],1,0,'L',0);
$pdf->SetXY(84,$newL);
$pdf->Cell(18,7,$d2['materialSize'],1,0,'L',0);
$pdf->SetXY(102,$newL);
$pdf->Cell(25,7,$d2['quantity'],1,0,'L',0);
$pdf->SetXY(127,$newL);
$pdf->Cell(15,7,'ROL',1,0,'L',0);
$pdf->SetXY(142,$newL);
$pdf->Cell(18,7,'OPEN',1,0,'L',0);
$pdf->SetXY(160,$newL);
$pdf->Cell(35,7,$d2['remarks'],1,0,'L',0);
$newL += 7;
}
}
$pdf-> Ln();
在SO的想法是,你编码的东西。如果您遇到问题,请向我们寻求帮助。我们不写你的代码给你 – RiggsFolly
呃..我第一次使用FPDF,并且我找不到任何其他网站的帮助。我所要求的只是一个想法,而不是写出整个代码。你最好冲洗你的自我配偶。 –
此报告的所有行上的序列号是否相同,或者此报告的每行上都是+1。你是否需要记住这个序列号,以便在你的下一次报告中,每行都可以是oldserial + 1。或者你会从每个报告 – RiggsFolly