Reputation: 310
I am trying to print the value from MySQL table to the PDFs using fpdf lib.
The following is the code sample:
$dcr_query="SELECT * FROM `incident_investigation` where ii_reference_no='$ref_num' and ii_company_id='$compny_id'";
$result_1 = mysql_query ($dcr_query) or ErrorHandler (array ('File' => __FILE__,'Line' => __LINE__,'SqlErr' =>mysql_error(),'SqlQry' => $dcr_query));
while($row_apr = mysql_fetch_array($result_1)) {
$method=$row_apr['ii_method'];
$pdf->SetY(50);
$pdf->SetX(35);
$pdf->SetFont('Times','',12);
$pdf->MultiCell(0,5,$method);
}
for example: The values of $method from the MySQL table is 'test method1' | 'test method2' | 'test method3' etc... So the out put in PDF should be like :
test method1
test method2
test method2
I want the $method
line by line.How can i do this?
Upvotes: 0
Views: 90
Reputation: 256
try this inside the loop,
$variable = $row['method']
$pdf->SetY($y_axis);
$pdf->SetX(25);
$pdf->Cell(30, 6, $variable, 1, 0, 'L', 1);
you can use this reference also
Upvotes: 1