//Queries for categories that should be displayed
$facultyQuery="SELECT * FROM people WHERE status_index=1 OR status_index=2 OR status_index=7 OR status_index=8 OR status_index=17 OR status_index=22 OR status_index=3 OR status_index=4 OR status_index=5 OR status_index=6 OR status_index=18 OR interdepartmental=1 OR status_index=9 OR status_index=10 OR status_index=11 OR status_index=21 OR status_index=13 ORDER BY lastname";
$graduateQuery="SELECT * FROM people WHERE status_index=14 ORDER BY lastname";
$staffQuery="SELECT * FROM people WHERE status_index=15 ORDER BY lastname";
$seniorQuery="SELECT * FROM people WHERE status_index=1 OR interdepartmental=1 OR status_index=18 ORDER BY lastname";
$juniorQuery="SELECT * FROM people WHERE status_index=2 OR status_index=8 OR status_index=17 OR status_index=22 ORDER BY lastname";
$emeritiQuery="SELECT * FROM people WHERE status_index=13 ORDER BY lastname";
$visitingQuery="SELECT * FROM people WHERE status_index=4 OR status_index=5 OR status_index=6 OR status_index=7 OR status_index=3 OR status_index=9 OR status_index=10 OR status_index=11 OR status_index=21 OR status_index=19 OR status_index=12 ORDER BY lastname";
$everyoneQuery="SELECT * FROM people WHERE status_index=1 OR status_index=2 OR status_index=7 OR status_index=8 OR status_index=17 OR status_index=22 OR status_index=3 OR status_index=4 OR status_index=5 OR status_index=6 OR status_index=18 OR interdepartmental=1 OR status_index=9 OR status_index=10 OR status_index=11 OR status_index=13 OR status_index=4 OR status_index=5 OR status_index=6 OR status_index=3 OR status_index=9 OR status_index=10 OR status_index=21 OR status_index=19 OR status_index=12 ORDER BY lastname";
//call the individual queries
if ( $sorting == "default") {
//displayQuery($facultyQuery, "Faculty");
displayQuery($everyoneQuery, "Faculty");
displayQuery($graduateQuery, "Graduate");
displayQuery($staffQuery, "Staff");
//displayQuery($visitingQuery, "Visiting");
} elseif ( $sorting == "staff") {
displayQuery($staffQuery, "Staff");
} elseif ( $sorting == "senior") {
displayQuery($seniorQuery, "Senior Faculty");
} elseif ( $sorting == "junior") {
displayQuery($juniorQuery, "Junior Faculty");
} elseif ( $sorting == "emeriti") {
displayQuery($emeritiQuery, "Emeriti");
} elseif ( $sorting == "visiting") {
displayQuery($visitingQuery, "Visiting, Adjunct and Research Faculty");
} elseif ( $sorting == "grad_students") {
displayQuery($graduateQuery, "Graduate Students");
}
function displayQuery($queryString, $header) {
global $DBName, $COLUMNS;
$column_count = 0;
$row_color = 0;
$result2 = mysql ($DBName, $queryString) or die(mysql_error());
// if status_index is non-empty, generate a table row for it//
if ( mysql_num_rows ( $result2 ) ) {
echo "