Hello
I have got a code below that works perfectly in generating html via PHP. However, I will like to export the results into PDF or Micorsoft word, but I am struggling. Please can anybody point me in the right direction
// Get house group details for this member
//$memberRecord = mysql_query("select `members_HouseGroup`.`description` AS `description`,`members_HouseGroup`.`HouseGroupLeader` AS `HouseGroupLeader`,`members_HouseGroup`.`HouseGroupLeader1` AS `HouseGroupLeader1`,`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`.`gender` AS `gender`,`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`.`nextkin` AS `nextkin`,`members_users`.`relationship` AS `relationship`,`members_users`.`telkin` AS `telkin`,`members_users`.`country` AS `country`,`members_users`.`username` AS `username`,`members_users`.`password` AS `password`,`members_users`.`status` AS `status`,`members_users`.`registration_timestamp` AS `registration_timestamp`,`members_users`.`email_verify_code` AS `email_verify_code`,`members_users`.`marital_status` AS `marital`, members_memberType.description as MemberType, group_concat(members_child.cfirstname ORDER BY members_child.dateOfBirth SEPARATOR ' , ') as child 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`)) left outer join members_child on (members_users.username=members_child.username or members_users.username=members_child.username1) ) where ((`members_users`.`memberTypeID` in (select id from members_memberType where housegroupind = 1)) and (`members_HouseGroup`.`id` = `members_users`.`housegroupID`)) and members_users.lastname like '" . $letter . "%' group by members_users.lastname union all select `members_HouseGroup`.`description` AS `description`,`members_HouseGroup`.`HouseGroupLeader` AS `HouseGroupLeader`,`members_HouseGroup`.`HouseGroupLeader1` AS `HouseGroupLeader1`,`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`.`gender` AS `gender`,`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`.`nextkin` AS `nextkin`,`members_users`.`relationship` AS `relationship`,`members_users`.`telkin` AS `telkin`,`members_users`.`country` AS `country`,`members_users`.`username` AS `username`,`members_users`.`password` AS `password`,`members_users`.`status` AS `status`,`members_users`.`registration_timestamp` AS `registration_timestamp`,`members_users`.`email_verify_code` AS `email_verify_code`,`members_users`.`marital_status` AS `marital`, members_memberType.description as MemberType, group_concat(members_child.cfirstname ORDER BY members_child.dateOfBirth SEPARATOR ' , ') as child 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`)) right outer join members_child on (members_users.username=members_child.username or members_users.username=members_child.username1 ) ) where ((`members_users`.`memberTypeID` in (select id from members_memberType where housegroupind = 1)) and (`members_HouseGroup`.`id` = `members_users`.`housegroupID`)) and members_users.lastname like '" . $letter . "%' group by members_users.lastname");
$memberRecord = mysql_query("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 ");
$query1 = "select `members_HouseGroup`.`description` AS `description`,`members_HouseGroup`.`HouseGroupLeader` AS `HouseGroupLeader`,`members_HouseGroup`.`HouseGroupLeader1` AS `HouseGroupLeader1`,`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`.`gender` AS `gender`,`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`.`nextkin` AS `nextkin`,`members_users`.`relationship` AS `relationship`,`members_users`.`telkin` AS `telkin`,`members_users`.`country` AS `country`,`members_users`.`username` AS `username`,`members_users`.`password` AS `password`,`members_users`.`status` AS `status`,`members_users`.`registration_timestamp` AS `registration_timestamp`,`members_users`.`email_verify_code` AS `email_verify_code``members_users`.`marital_status` AS `marital`,members_memberType.description as MemberType, group_concat(members_child.cfirstname ORDER BY members_child.dateOfBirth SEPARATOR ' , ') as child 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`)) left join members_child on (members_child.username=members_users.username)) where ((`members_users`.`memberTypeID` in (select id from members_memberType where housegroupind = 1)) and (`members_HouseGroup`.`id` = `members_users`.`housegroupID`)) and members_users.lastname like '" . $letter . "%' group by members_users.lastname";
$number=mysql_num_rows($memberRecord);
$amp = "&";
$countRec = 0;
$space = "nbsp;nbsp;" ;
//echo "number of records are $number";
while (($rowMember = mysql_fetch_array($memberRecord)) != false) {
$id = $rowMember['id'];
//echo "ID is {$id}";
$name = $rowMember['firstname'].' '.$rowMember['lastname'];
$firstname = $rowMember['firstname'];
//echo "name again is $name";
$spfirstname = $rowMember['spfirstname'];
$lastname = $rowMember['lastname'];
$country = $rowMember['country'];
$phone = $rowMember['phone'];
$address1 = $rowMember['address1'];
$address2 = $rowMember['address2'];
$town = $rowMember['towns'];
$PostCode = $rowMember['postCode'];
$homephone = $rowMember['homephone'];
$businessphone = $rowMember['businessphone'];
$mobilephone = $rowMember['mobilephone'];
$email = $rowMember['email'];
$busemail = $rowMember['busemail'];
$nextkin = $rowMember['nextkin'];
$memberTypeDesc = $rowMember['MemberType'];
$houseGroup = $rowMember['description'];
$username = $rowMember['username'];
//$child = $rowMember['child'];
//echo " username pulled is $username";
//echo "<td class='style2'>$name</td>";
$houseGroupLeader1 = $rowMember['HouseGroupLeader1'];
//echo "houseGroupLeader1 is {$houseGroupLeader1}";
$countRec = $countRec + 1;
//echo "Record number is $countRec";
// first let us populate the temp tables for this session
//$sqlTempMin="insert into vwMembersMinistryDetails select '$session', `mu`.`id` AS `id`,`mu`.`username` AS `username`,`mu`.`firstname` AS `firstname`,`mu`.`email` AS `email`,`mu`.`lastname` AS `lastname`,`mu`.`memberTypeID` AS `memberTypeId`,`mm`.`name` AS `MinistryName`,`mmr`.`name` AS `RoleName`, '$admin' from (((`members_users` `mu` left join `members_ministryParticipant` `mmp` on((`mu`.`id` = `mmp`.`membersID`))) left join `members_Ministry` `mm` on((`mm`.`id` = `mmp`.`ministryID`))) left join `members_Ministry_Role` `mmr` on((`mmr`.`id` = `mmp`.`roleID`))) where (`mu`.`memberTypeID` > 1 ) and `mm`.`name` is not null ";
//$resultTempMin = mysql_query($sqlTempMin) or die(mysql_error());
$membersSpouse = mysql_query("SELECT firstname FROM members_spouseLink where spouseUserID='$username'");
while (($rowMemberSpouse = mysql_fetch_array($membersSpouse)) != false) {
$spfirstname = $rowMemberSpouse['firstname'];
}
$sqlchild = "select `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`, group_concat(members_child.cfirstname ORDER BY members_child.dateOfBirth SEPARATOR ' , ') as child from ((`members_users` inner join members_child on (members_child.username=members_users.username) ) ) where members_child.username = '$username' and ((`members_users`.`memberTypeID` in (select id from members_memberType where housegroupind = 1)) ) group by members_users.lastname";
//echo "children select statement is $sqlchild";
$memberChildRecord = mysql_query("select `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`, group_concat(members_child.cfirstname ORDER BY members_child.dateOfBirth SEPARATOR ' , ') as child from ((`members_users` inner join members_child on (members_child.username=members_users.username) ) ) where members_child.username = '$username' or members_child.username1 = '$username' and ((`members_users`.`memberTypeID` in (select id from members_memberType where housegroupind = 1)) ) group by members_child.username");
switch($status){
case '2':
$statustext = '<font color="green">Active</font>';
break;
case '1':
$statustext = '<font color="red">Inactive</font> - <i>Needs admin approval</i>';
break;
case '0':
$statustext = '<font color="red">Inactive</font> - <i>Needs email verification</i>';
break;
}
$query = mysql_query("SELECT * FROM members_child where username ='$username' OR username1 = '$username'");
$num=mysql_num_rows($query);
//echo "Total records in Children table= ". $num;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Member Information</title>
<script type="text/javascript" src="../images/hint.js">
/***********************************************
* Show Hint script- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
</script>
<script type="text/javascript">
function deleteuser(username){
var answer = confirm('Are you sure you want to delete the user "'+username+'"?');
if(answer==true){
window.location="./userdel.php?user="+username;
}
}
function denyuser(username){
var answer = confirm('Are you sure you want to deny the user "'+username+'"? This will completely remove them from the database.');
if(answer==true){
window.location="./useraccept.php?action=deny&user="+username;
}
}
function acceptuser(username){
var answer = confirm('Are you sure you want to accept the user "'+username+'"? This will update their status to approved and will give them access to the protected area.');
if(answer==true){
window.location="./useraccept.php?action=accept&user="+username;
}
}
</script>
<link href="../images/admin.css" rel="stylesheet" type="text/css" media="all" />
</head>
<body>
<table align="left" width="400" >
<tr>
<td>
<table align="left" width="35">
<? if (!empty($spfirstname)) { ?>
<tr>
<td width="20" class="style2"><?=$firstname?></td>
<td class="style2"> & </td>
<td class="style2"><?=$spfirstname?></td>
<td class="style2"><?=$lastname?></td>
</tr>
<? } else { ?>
<tr>
<td width="20" class="style2"><?=$firstname?></td>
<td class="style2"><?=$lastname?></td>
</tr>
<? } ?>
</table>
<? while (($rowChild = mysql_fetch_array($memberChildRecord)) != false) {
$numberChild=mysql_num_rows($memberChildRecord);
$leftBrac = "(";
$rightBrac = ")";
$child = $rowChild['child'];
$child = $leftBrac.$child.$rightBrac;
?>
<tr>
<td colspan="3" class="style2"><?=$child?></td>
</tr>
<? } ?>
<tr>
<td class="style2"><?=$address1?></td>
</tr>
<tr>
<td class="style2"><?=$address2?></td>
</tr>
<tr>
<td class="style2"><?=$town?></td>
</tr>
<tr>
<td class="style2"><?=$PostCode?></td>
</tr>
<tr>
<td class="style2"><?=FormatPhoneNumber($homephone)?></td>
</tr>
<tr>
<td class="style2"><?=FormatPhoneNumber($businessphone)?></td>
</tr>
<tr>
<td class="style2"><?=FormatPhoneNumber($mobilephone)?></td>
</tr>
<tr>
<td class="style2"><?=$email?></td>
</tr>
<tr>
<td class="style2"><?=$busemail?></td>
</tr>
<tr>
<td class="style2"><?=$memberTypeDesc?></td>
</tr>
<tr>
<td width="200" class="style2"><?=$houseGroup?></td>
</tr>
<tr>
<td height="100">
</td>
</tr>
</td>
</tr>
</table>
<? }
?>
<table align="center">
<tr>
<td align="center">
</td>
</tr>
</table>
</body>
</html>