C:\gystdoit\famed\familygpslookup.php.txt Friday January 27th, 2017 3:09:56 PM works great next step is to create classes for family andd fam_member use code below to write methods (functions) for the class use the function __constructor to handle initialization activities - call methods to calc derived properties that are reported below portrait child portrait branch link ... _END3; //$spousedied = spouserip( $fam_id); $portraitname = 'Children of ' . $father . '
and ' . $mother; $portrait = '../family/' . $surname . '_' . $fam_id . '_portrait.svg'; if ( $wed_date == '0000-00-00' ) { $age = ' '; $wed_date = ''; } else { $spousedied = '0000-00-00'; $age = age( $wed_date , $spousedied); $age = $age . ' Years'; } $famtype = famside( $fam_id); if ($famtype == 'D') { $border = 'purple'; } else { $border = ($famtype == 'F') ? 'red' : 'blue'; } $branch = substr( $fam_id,0,1); $branchoutline = ' Branch '; $famout = $famout . ''; $famout = $famout . sprintf(" \n", $branchoutline ); $famout = $famout . sprintf(" \n", $fam_id, $father_id, $mother_id ); $famout = $famout . sprintf(" \n", $father, $mother ); $famout = $famout . sprintf(" \n", $wed_date,$logo, $age ); if ( $photo) $famout = $famout . sprintf(" \n", $photo, $photo ); $famout = $famout . sprintf(" \n", $portrait, $portraitname); $famout = $famout . '
Branch %s
ID Fam ID: %s

Father: %s

Mother: %s
Name Father: %s

Mother: %s
Married %s %s %s
Photo

%s

Portrait %s
'; /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); } // process Fam_Member search on Ind ID if (isset($_POST['indid'])) { $indid = sanitizeString($_POST['indid']); $link = mysqli_connect($hn, $un, $pw, $db); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } /* create a prepared statement */ if ($stmt = mysqli_prepare($link, "SELECT fam_id , ind_id , given , married , born, died, male , photo , obit FROM fam_member WHERE ind_id=?")) { /* bind parameters for markers */ mysqli_stmt_bind_param($stmt, "s",$indid); /* execute query */ mysqli_stmt_execute($stmt); /* bind result variables */ mysqli_stmt_bind_result($stmt, $fam_id , $ind_id , $given , $married , $born , $died, $male , $photo , $obit ); /* fetch value */ mysqli_stmt_fetch($stmt); echo $str; $portraitname = $portrait = ''; $pos = strpos($ind_id, '.0'); // if nonblood use married name for portrait if ( $pos ) { if ($male = "T") { $fullname = explode( " ",$given); $surname = $fullname[ count($fullname) - 1 ]; $portraitname = 'Children of ' . $given; $portrait = '../family/' . $surname . '_' . $fam_id . '_portrait.svg'; } if ($married) { $fullname = explode( " ",$married); $surname = $fullname[ count($fullname) - 1 ]; $portraitname = 'Children of ' . $married; $portrait = '../family/' . $surname . '_' . $fam_id . '_portrait.svg'; } } else { $fullname = explode( " ",$given); $surname = $fullname[ count($fullname) - 1 ]; $portraitname = 'Siblings of ' . $given; $portrait = '../family/' . $surname . '_' . $fam_id . '_portrait.svg'; if ($male = "T") { $fullname = explode( " ",$given); $surname = $fullname[ count($fullname) - 1 ]; $childportraitname = 'Children of ' . $given; $childfamid = childfamid( $ind_id); $childportrait = '../family/' . $surname . '_' . $childfamid . '_portrait.svg'; } else { $fullname = explode( " ",$married); $surname = $fullname[ count($fullname) - 1 ]; $childportraitname = 'Children of ' . $given; $childfamid = childfamid( $ind_id); $childportrait = '../family/' . $surname . '_' . $childfamid . '_portrait.svg'; } } $age = age( $born , $died); $famtype = famside( $ind_id); if ($famtype == 'D') { $border = 'purple'; } else { $border = ($famtype == 'F') ? 'red' : 'blue'; } $branch = substr( $fam_id,0,1); $branchoutline = ' Branch '; $out = $out . ''; $out = $out . sprintf(" \n", $branchoutline ); $out = $out . sprintf(" \n", $fam_id , $ind_id ); $out = $out . sprintf(" \n", $given ); if ( $married) $out = $out . sprintf(" \n", $married); $out = $out . sprintf(" \n" , $died); $out = $out . sprintf(" \n", $obit, $obit); } else { $out = $out . " \n"; } $out = $out . sprintf(" \n", $age ); $out = $out . sprintf(" \n", $photo, $photo ); $out = $out . sprintf(" \n", $portrait, $portraitname,$childportrait, $childportraitname); $gender = ( $male == 'T' ) ? 'Male' : 'Female'; $out = $out . sprintf("
Branch %s
ID Fam: %s

Individual: %s
Given

%s

Married

%s

Dates Birth: %s ", $born ); if ( $died != '0000-00-00') { $out = $out . sprintf("

Died: %s
Obituary %s
Age

%s

Photo

%s

Portrait %s

%s
Gender

%s

\n", $gender ); /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); } $out = (isset($_POST['indid'])) ? $out : ' '; $famout = (isset($_POST['famid'])) ? $famout : ' '; echo <<<_END Family GPS Lookup
Family
Family ID
$fampicklist

Family GPS

Family Member
Individual ID
$picklist
Search Family and/or
Family Member table
on ID number
Family Family Member
$famout $out
$filesout
_END; function sanitizeString($var) { $var = stripslashes($var); $var = strip_tags($var); $var = htmlentities($var); return $var; } ?>