在PHP中的fpdf输出重叠

Iam a beginner in using fdpf in php . I have searched a lot but couldn't find the solution

I need to get output like this

expected output

but the output of my code is

current output

the code:

$row1a=mysql_fetch_array($sql_1a);
$row1b=mysql_fetch_array($sql_1b);
$row1c=mysql_fetch_array($sql_1c);

$pdf->Cell(6,6," 1 a) ",0,0);
$x = $pdf->GetX();
$y = $pdf->GetY();  
$pdf->MultiCell(150,6,"{$row1a['Question']}",0,1);
$pdf->SetXY($x + 160, $y);
$pdf->Cell(6,6,"{$row1a['Mark']}",0,1);

$pdf->Cell(6,6," b) ",0,0);
$x = $pdf->GetX();
$y = $pdf->GetY();          
$pdf->MultiCell(150,6,"{$row1b['Question']}",0,1);
$pdf->SetXY($x + 160, $y);
$pdf->Cell(6,6,"{$row1b['Mark']}",0,1);

$pdf->Cell(6,6," c) ",0,0);
$x = $pdf->GetX();
$y = $pdf->GetY();  
$pdf->MultiCell(150,6,"{$row1c['Question']}",0,1);
$pdf->SetXY($x + 160, $y);
$pdf->Cell(6,6,"{$row1c['Mark']}",0,1);

where $row1a,$row1b,$row1c are the variables used to fetch the question and marks from database. Since the question can be of variable length fetched from database , it overlaps with the next question.

Thanks in advance.

try this on the overlapping row:

$height =  round(strlen($row1b['Question']) / 35);
$height = ($height < 1 ? 1 : $height);
$height = $height * 6;

$pdf->MultiCell(150,$height,"{$row1b['Question']}",0,1);

Perform a GetY() update after every MultiCell() call (this pushes the current Y value every time downwards) and recalculate it properly for every further MultiCell().