
$cat = array( "southern" , "ocean" , "nep" , "georges" , "bank" ,
"executive" , "committee" , "staff" , "ex" , "officio" ,
"agency" , "contact" , "ssc" );
if(!empty($_GET['s'])){
$suf='';
$terms=preg_split ("/(\s+|\+)/", $_GET['s']);
//print_r($terms);
$num=count($terms);
for($i=0;$i<$num;$i++){
$term = (strtolower($terms[$i]) == "george\'s") ? "georges" : addslashes($terms[$i]);
if( in_array(strtolower($term),$cat) ){
$suf.="category LIKE '%$term%' OR ";
}
else{
$suf.="last_name LIKE '%$term%' OR first_name LIKE '%$terms%' OR ";
}
}
$suf=substr($suf,0,-4);
$query1="SELECT * FROM personnel WHERE " . $suf . " ORDER BY last_name";
} // if(!empty($_GET[s])){
if(!empty($query1)){
$result=mysql_query($query1);
if(!mysql_num_rows($result)){
echo '
Sorry, there are no results for your query. ' . "\n";
}
while($row=mysql_fetch_assoc($result)){
echo '' . "\n";
if(!empty($row['position'])){
echo '' . $row['last_name'] . ', ' . $row['first_name'] . ' (' . $row['position'] . ") \n";
}
else{
echo '' . $row['last_name'] . ', ' . $row['first_name'] . " \n";
}
echo $row['institute'] . " \n";
echo $row['phone'] . " \n";
if(!empty($row['fax'])){
echo $row['fax'] . " (fax) \n";
}
echo '' . $row['email'] . "\n";
echo " \n";
}
echo " \n";
}
/*
$i = '
A | B | C | D | E |
F | G | H | I | J |
K | L | M | N | O |
P | Q | R | S | T |
U | V | W | X | Y |
Z ';
echo $i;
*/
$query="SELECT last_name,first_name,position,institute,phone,fax,email FROM personnel ORDER BY last_name";
$result=mysql_query($query);
$index="";
echo ' ';
$j=65;
$nav="";
for($i=0;$row=mysql_fetch_assoc($result);$i++){
$names[$i] = strtoupper(substr($row[last_name],0,1));
$info[$i] = $row;
}
for($i=0;$i' . $a . ' | ';
$index=$a;
$j++;
//$i++;
}
if( $a != chr($j) && $a != $index){
//$j++;
$d=chr($j);
$nav .= $d . ' | ';
$j++;
}
if($a == $index){
$i++;
}
if($j == 91) break;
}
while($j < 90){
$d=chr($j);
$nav .= $d . ' | ';
$j++;
}
$nav .= chr(90);
echo $nav;
$anchor="";
$info = array_reverse($info);
while( $row=array_pop($info) ){
if( ($a=strtoupper(substr($row[last_name],0,1))) != $anchor){
$anchor=$a;
echo "\n" . '' . "\n";
//echo $i;
}
echo '' . "\n";
if(!empty($row[position])){
echo '' . $row['last_name'] . ', ' . $row['first_nam'] . ' (' . $row['position'] . ") \n";
}
else{
echo '' . $row['last_name'] . ', ' . $row['first_name'] . " \n";
}
echo $row['institute'] . " \n";
echo $row['phone'] . " \n";
if(!empty($row[fax])){
echo $row[fax] . " (fax) \n";
}
echo '' . $row['email'] . "\n";
echo " \n";
}
?>
Last updated: 6 April, 2004
Please address any comments or questions to:
U.S. GLOBEC Webmaster
|