Update Ive got it kind of working but it doesnt line the columns up properly this is code ive used:
<?php
define('FPDF_FONTPATH','font/');
require('fpdf.php');
require("connect.inc");
$connection = mysql_connect($hostname, $username, $password) or die ("Unable to connect!");
mysql_select_db($databaseName) or die ("Unable to select database!");
//Connect to your database
//Select the Products you want to show in your PDF file
$result=mysql_query("select name,features,description,price from product1 ORDER BY category");
$number_of_products = mysql_numrows($result);
//For each row, add the field to the corresponding column
while($row = mysql_fetch_array($result))
{
$name = $row["name"];
$features = $row["features"];
$description = $row["description"];
$price = $row["price"];
$column_name = $column_name.$name."\n";
$column_features = $column_features.$features."\n";
$column_description = $column_description.$description."\n";
$column_price = $column_price.$price."\n";
}
mysql_close();
//Create a new PDF file
$pdf=new FPDF();
$pdf->Open();
$pdf->AddPage();
//Fields Name position
$Y_Fields_Name_position = 5;
//Table position, under Fields Name
$Y_Table_Position = 11;
//First create each Field Name
//Gray color filling each Field Name box
$pdf->SetFillColor(232,232,232);
//Bold Font for Field Name
$pdf->SetFont('Arial','B',12);
$pdf->SetY($Y_Fields_Name_position);
$pdf->SetX(5);
$pdf->Cell(35,6,'Name',1,0,'L',1);
$pdf->SetX(40);
$pdf->Cell(80,6,'Features',1,0,'L',1);
$pdf->SetX(120);
$pdf->Cell(150,6,'Description',1,0,'L',1);
$pdf->SetX(270);
$pdf->Cell(20,6,'Price',1,0,'L',1);
$pdf->SetX(290);
//Now show the 3 columns
$pdf->SetFont('Arial','',12);
$pdf->SetY($Y_Table_Position);
$pdf->SetX(5);
$pdf->MultiCell(35,6,$column_name,1);
$pdf->SetY($Y_Table_Position);
$pdf->SetX(40);
$pdf->MultiCell(80,6,$column_features,1);
$pdf->SetY($Y_Table_Position);
$pdf->SetX(120);
$pdf->MultiCell(150,6,$column_description,1);
$pdf->SetX(270);
$pdf->MultiCell(20,6,$column_price,1);
$pdf->SetX(290);
//Create lines (boxes) for each ROW (Product)
//If you don't use the following code, you don't create the lines separating each row
$i = 0;
$pdf->SetY($Y_Table_Position);
while ($i < $number_of_products)
{
$pdf->SetX(5);
$pdf->MultiCell(290,6,'',1);
$i = $i +1;
}
$pdf->Output();
?>
It works but it displays the columns wrongly see attached pic
If someone could help me get the coloumns on the same page please
Thanks