i want to align my data properly in pdf file frm mysql database. but the result i get is not wat i want, some last column just come below the other while i wanted to align with the other column. i have tried something like this.
while (ob_get_level())
ob_end_clean();
header("Content-Encoding: None", true);
$host="localhost";
$user="root";
$password="";
$db_name="pdf_test";
$conn=mysql_connect($host,$user,$password) or die("cannot connect to the
database".mysql_error());
mysql_select_db($db_name,$conn)or die("cannot select the database".mysql_error());
include('fpdf.php');
$q=mysql_query("select * from education_mailstone");
$number_of_persons=mysql_num_rows($q);
//initialize the 4 columns and the total
$column_name="";
$column_school="";
$column_year="";
$column_score="";
//For each row add field to the specific column
while($row=mysql_fetch_array($q)){
$name=$row['name'];
$school=$row['school'];
$year=$row['year'];
$score=$row['score'];
$column_name=$column_name.$name."\n";
$column_school=$column_school.$school."\n";
$column_year=$column_year.$year."\n";
$column_score=$column_score.$score."\n";
}
$pdf=new FPDF();
$pdf->AddPage();
$Y_Fields_Name_position=20;
$Y_Table_position=26;
$pdf->SetFillColor(232,232,232);
$pdf->SetFont('Arial','B',12);
$pdf->SetY($Y_Fields_Name_position);
$pdf->SetX(10);
$pdf->Cell(400,6,'NAME OF STUDENT',1,0,'L',1);
$pdf->SetX(60);
$pdf->Cell(400,6,'NAME OF THE SCHOOL',1,0,'L',1);
$pdf->SetX(120);
$pdf->Cell(400,6,'COMPLETION YEAR',1,0,'L',1);
$pdf->SetX(180);
$pdf->Cell(50,6,'SCORE',1,0,'L',1);
$pdf->Ln();
$pdf->SetFont('Arial','',12);
$pdf->SetY($Y_Table_position);
$pdf->SetX(10);
$pdf->MultiCell(400,6,$column_name,1);
$pdf->SetY($Y_Table_position);
$pdf->SetX(60);
$pdf->MultiCell(400,6,$column_school,1);
$pdf->SetY($Y_Table_position);
$pdf->SetX(120);
$pdf->MultiCell(400,6,$column_year,1);
$pdf->SetX(180);
$pdf->MultiCell(50,6,$column_score,1);
$pdf->Ln();
$i = 0;
$pdf->SetY($Y_Table_position);
while ($i < $number_of_persons)
{
$pdf->SetX(10);
$pdf->MultiCell(120,6,'',1);
$i = $i +1;
}
$pdf->Output();
so wat am i doin wrong?