在 fpdf 中操作和定位单元格

Manipulating and positioning cells in fpdf

我正在打印这个table

但我有的是这个

Ave 和百分比应低于标准(考试、实验室、测验和背诵)

到目前为止,这是我的代码:

$sql_criteria = mysql_query("
    SELECT DISTINCT criteria,
           percentage 
      FROM tb_equivalent
     WHERE instructor_id = '$inst_id' 
       AND description = '$desc' 
       AND subj_code = '$code' 
       AND term = '$term'
");

$criteria = array();
while ($row = mysql_fetch_assoc($sql_criteria)) {
    $criteria[] = $row['criteria'];

    $pdf->SetFont('Arial','',9);
    $pdf->Cell(35,5,$row['criteria'],1,'','C');
    $pdf->Cell(17.5,5,'Ave',1,'','C');
    $pdf->Cell(17.5,5,$row['percentage']."%",1,'','C');
}

$pdf->Cell(35,10,'Grade',1,0,'C');
$pdf->Cell(35,10,'Remark',1,0,'C');

任何对我的问题的帮助将不胜感激,请...请提前指出我的代码有什么问题

while($row = mysql_fetch_assoc($sql_criteria)){
    $criteria[] = $row['criteria'];
    $pdf->SetFont('Arial','',9);
    $pdf->Cell(35,5,$row['criteria'],1,'','C');
    $x = $pdf->GetX(); // get current x pos
    $y = $pdf->GetY(); // get current y pos
    $pdf->SetXY($x-35, $y+5); // move pointer back to start of and under criteria cell
    $pdf->Cell(17.5,5,'Ave',1,'','C');
    $pdf->Cell(17.5,5,$row['percentage']."%",1,'','C');
    $pdf->SetXY($x, $y); // set pointer back to end of criteria cell
}