include("config.php"); include("genlib.php"); $textpart = "surnames"; include("getlang.php"); include("$mylanguage/text.php"); @set_time_limit(0); db_connect($database_host,$database_name,$database_username,$database_password) or exit; $query = "SELECT gedcom, ucase(gedcom) as uged FROM $trees_table ORDER BY uged"; $treeresult = mysql_query($query) or die ("$admtext[cannotexecutequery]: $query"); $numtrees = mysql_numrows($treeresult); ?>
echo $text[surnamelist]; ?>
echo $text[newsearch]; ?> | echo $text[homepage]; ?>
if( $numtrees > 1 ) { ?> } ?> if( $tree ) { $wherestr = "WHERE gedcom = \"$tree\""; $wherestr2 = "AND gedcom = \"$tree\""; } else { $wherestr = ""; $wherestr2 = ""; } $linkstr = ""; $nosurname = urlencode($text[nosurname]); $query = "SELECT ucase(left(lastname,1)) as firstchar, ucase( binary(left(lastname,1) ) ) as binfirstchar FROM $people_table $wherestr GROUP BY binfirstchar ORDER by binfirstchar"; $result = mysql_query($query) or die ("$text[cannotexecutequery]: $query"); if( $result ) { $initialchar = 1; while( $surname = mysql_fetch_assoc( $result ) ) { if( $initialchar != 1 ) { $linkstr .= " | "; } if( $surname[firstchar] == "" ) { $surname[firstchar] = $text[nosurname]; $linkstr .= "$text[nosurname] | "; } else { $linkstr .= "$surname[firstchar]"; $firstchars[$initialchar] = $surname[firstchar]; $initialchar++; } } mysql_free_result($result); } ?>echo $text[showmatchingsurnames]; ?>
for( $scount = 1; $scount < $initialchar; $scount++ ) { echo "\n"; $urlfirstchar = addslashes($firstchars[$scount]); ?> echo $firstchars[$scount]; ?>
$query = "SELECT ucase(lastname) as lastname, ucase( binary(lastname) ) as binlast, count( ucase( lastname ) ) as lncount FROM $people_table WHERE ucase(binary(lastname)) LIKE \"$urlfirstchar%\" $wherestr2 GROUP BY binlast ORDER by binlast";
$result = mysql_query($query) or die ("$text[cannotexecutequery]: $query");
if( $result ) {
$snnum = 1;
$num_in_col = 20;
$numrows = mysql_num_rows($result);
$numcols = floor($numrows / $num_in_col);
if( $numcols > 4 ) {
$numcols = 4;
$num_in_col = ceil($numrows / 4 );
}
$num_in_col_ctr = 0;
while( $surname = mysql_fetch_assoc( $result ) ) {
$surname2 = urlencode( $surname[lastname] );
$name = $surname[lastname] ? "$surname[lastname]" : "$text[nosurname]";
echo "$snnum. $name ($surname[lncount]) \n"; $snnum++; $num_in_col_ctr++; if( $num_in_col_ctr == $num_in_col ) { echo " | \n\n | "; $num_in_col_ctr = 0; } } mysql_free_result($result); } ?> |