Hello
Please can any one help me? I want to export from mysql to pdf, using PHP and FPDF. Please can some one tell me how to export, using the following format
Firstname Lastname
Address
Town
Post Code
The code below will only do it in this format
Firstname Lastname Address Town Post Code
<?php
require('mysql_table.php');
require('../db_config.php');
require('../global.php');
// connect to the database
db_connect($mysql['username'], $mysql['password'], $mysql['database'],$mysql['host']);
$config = get_config($mysql['prefix']);
// start the session
admin_sessions($config['admin_session_expire']);
if(!isset($_SESSION['logged_in'])){
redirect('./login.php');
}
class PDF extends PDF_MySQL_Table
{
function Header()
{
//Title
$this->SetFont('Arial','',18);
$this->Cell(0,6,'Members who serve in '. $_GET['name'] .'',0,1,'C');
$this->Ln(10);
//Ensure table header is output
parent::Header();
}
}
$pdf=new PDF();
$pdf->AddPage();
$pdf->AddCol('Firstname',30,'Firstname');
$pdf->AddCol('Surname',30,'Surname');
$pdf->AddCol('address1',30,'Address');
$pdf->AddCol('address2',30,'Address');
$pdf->AddCol('postCode',30,'Post Code');
$pdf->AddCol('towns',30,'Town');
$prop=array('HeaderColor'=>array(255,150,100),
'color1'=>array(210,245,255),
'color2'=>array(255,255,210),
'padding'=>2);
$pdf->Table("select `members_HouseGroup`.`description` AS `description`,`members_HouseGroup`.`id` AS `housegroupID`,`members_users`.`id` AS `id`,`members_users`.`memberTypeID` AS `memberTypeID`,`members_users`.`firstname` AS `firstname`,`members_users`.`lastname` AS `lastname`,`members_users`.`marital_status` AS `marital_status`,`members_users`.`email` AS `email`,`members_users`.`homephone` AS `homephone`,`members_users`.`businessphone` AS `businessphone`,`members_users`.`mobilephone` AS `mobilephone`,`members_users`.`address1` AS `address1`,`members_users`.`address2` AS `address2`,`members_users`.`towns` AS `towns`,`members_users`.`postCode` AS `postCode`,`members_users`.`relationship` AS `relationship`,`members_users`.`username` AS `username`,`members_users`.`status` AS `status`,`members_users`.`marital_status` AS `marital`, members_memberType.description as MemberType from ((`members_users` left join`members_memberType` on((`members_memberType`.`id` = `members_users`.`memberTypeID`))) left join `members_HouseGroup` on((`members_HouseGroup`.`id` = `members_users`.`housegroupID`)) ) where ((`members_users`.`memberTypeID` in (select id from members_memberType where housegroupind = 1)) ) and username not in (select username from members_spouseLink) order by members_users.lastname",$prop);
$pdf->Output();
?>