PHP Code:
function getfamilynames($familymember, $generation){
$familyname = array(array());
for($i=0; $i<=$generation; $i++){
for($j=0; $j<count($familymember[$i]); $j++){
$stmt = $adopts->query("SELECT * FROM {$GLOBALS['prefix']}owned_adoptables WHERE aid = '{$familymember[$i][$j]}'");
$thisadopt = $stmt->fetchObject();
if(!is_object($thisadopt)) $familyname[$i][$j] = "<br>";
else $familyname[$i][$j] = $thisadopt->name;
}
}
return $familyname;
}