Faculty and Staff Directory.


"; //echo "sort = ".$sort."

"; //echo "toggle = ".$toggle."

"; //echo "s_loc = ".$s_loc."

"; //echo "s_dept = ".$s_dept."

"; //echo "s_pos = ".$s_pos."

"; //echo "s_name1 = ".$s_name1."

"; //echo "s_name2 = ".$s_name2."

"; //echo "id = ".$id."

"; switch ($id) { case "A": $query="select * from directory where last LIKE 'A%' ORDER BY last"; break; case "B": $query="select * from directory where last LIKE 'B%' ORDER BY last"; break; case "C": $query="select * from directory where last LIKE 'C%' ORDER BY last"; break; case "DE": $query="select * from directory where ((last LIKE 'D%') or (last LIKE 'E%')) ORDER BY last"; break; case "F": $query="select * from directory where last LIKE 'F%' ORDER BY last"; break; case "G": $query="select * from directory where last LIKE 'G%' ORDER BY last"; break; case "H": $query="select * from directory where last LIKE 'H%' ORDER BY last"; break; case "IJ": $query="select * from directory where ((last LIKE 'I%') or (last LIKE 'J%')) ORDER BY last"; break; case "KL": $query="select * from directory where ((last LIKE 'K%') or (last LIKE 'L%')) ORDER BY last"; break; case "M": $query="select * from directory where last LIKE 'M%' ORDER BY last"; break; case "NO": $query="select * from directory where ((last LIKE 'N%') or (last LIKE 'O%')) ORDER BY last"; break; case "PQ": $query="select * from directory where ((last LIKE 'P%') or (last LIKE 'Q%')) ORDER BY last"; break; case "R": $query="select * from directory where last LIKE 'R%' ORDER BY last"; break; case "S": $query="select * from directory where last LIKE 'S%' ORDER BY last"; break; case "T": $query="select * from directory where last LIKE 'T%' ORDER BY last"; break; case "UV": $query="select * from directory where ((last LIKE 'U%') or (last LIKE 'V%')) ORDER BY last"; break; case "WXYZ": $query="select * from directory where ((last LIKE 'W%') or (last LIKE 'X%') OR (last LIKE 'Y%') OR (last LIKE 'Z%')) ORDER BY last"; break; } switch ($s_loc) { case "Alisal Campus - Building A": $s_loc2="AC-A"; break; case "Alisal Campus - Building B": $s_loc2="AC-B"; break; case "Alisal Campus - Building C": $s_loc2="AC-C"; break; case "King City Education Center": $s_loc2="KC"; break; case "Main Campus - Athletics Offices/Gym": $s_loc2="H"; break; case "Main Campus - College Administration North": $s_loc2="D"; break; case "Main Campus - College Administration South": $s_loc2="E"; break; case "Main Campus - Student Services": $s_loc2="B"; break; case "Alisal Campus - Child Development Center": $s_loc2="AC-E"; break; case "Main Campus - Child Development Center": $s_loc2="M"; break; case "Main Campus - Field": $s_loc2="P"; break; case "Main Campus - Student Center": $s_loc2="C"; break; case "Main Campus - Human Resources": $s_loc2="T"; break; case "Main Campus - Maintenance": $s_loc2="L"; break; case "Main Campus - Merrill Hall": $s_loc2="N"; break; case "Main Campus - Facilities Development": $s_loc2="R"; break; case "Main Campus - Visual Arts": $s_loc2="J"; break; case "Main Campus - Performing Arts": $s_loc2="K"; break; case "Main Campus - Library & LRC": $s_loc2="A1"; break; } $link = mysql_connect("old-www.hartnell.edu", "hrstaff", "datalink"); $db = "faculty"; if (!$sort) {$sort = "last";} // Connect to database and table if (! $link) die ("No Good" ); //echo "Successfully connected to server...

"; mysql_select_db ( $db ) or die ("Cant open $db; ".mysql_error() ); //echo "Successfully connected to database...

"; // ---------------------------------------------------------------------------------------------------------------------------------------- if ($toggle=="all_emp") $query = "select * from directory where first !='' ORDER BY $sort"; else if ($toggle=="all_dept") $query = "select * from directory where first ='' ORDER BY $sort"; else if (($s_loc) == "Main Campus - Performing Arts") $query = "select * FROM directory where location LIKE 'K1%' OR location LIKE 'KB%' ORDER BY $sort"; else if (($s_loc) == "Main Campus - Library & LRC") $query = "select * FROM directory where location LIKE 'A1%' OR location LIKE 'A2%' ORDER BY $sort"; else { if (!$s_name1) {$s_name1=" ";} if (!$s_name2) {$s_name2=" ";} if (!$s_dept) {$s_dept=" ";} if (!$s_loc) {$s_loc2=" ";} if (!$s_pos) {$s_pos=" ";} $query = "select * FROM directory WHERE first LIKE '".$s_name1."%' OR last LIKE '".$s_name2."%' OR position LIKE '".$s_pos."%' OR location LIKE '".$s_loc2."%' OR area LIKE '".$s_dept."%' ORDER BY $sort"; } $result = mysql_query($query); $num_results = mysql_num_rows($result); if ($num_results=="0") { echo "Sorry, your search produced no results, please try again."; } else { echo "
"; echo "
"; echo "\n"; print "\n"; if ($toggle=="all_dept") print "\t\n"; else print "\t\n"; if ($toggle=="all_dept") print ""; else print "\t\n"; print "\t\n"; if ($toggle=="all_dept") print ""; else print "\t\n"; if ($toggle=="all_dept") print "\t\n"; else print "\t\n"; print "\t\n"; if ($toggle=="all_dept") print "\t\n"; else print "\t\n"; print ""; while ( $a_row = mysql_fetch_array( $result ) ) { //print "\t\n"; if (!(mysql_real_escape_string($a_row['first']))=="") print ""; else print ""; print "\t"; if (!(mysql_real_escape_string($a_row['url']))=="") print"\n"; else print"\n"; if ($toggle=="all_dept") print ""; else { if ((mysql_real_escape_string($a_row['first']))=="") print"\n"; else print"\n"; } if (!(mysql_real_escape_string($a_row['pre']))=="") print "\n"; else print "\n"; if ($toggle=="all_dept") print ""; else{ if ((mysql_real_escape_string($a_row['position']))=="") print"\n"; else print "\n"; } if ((mysql_real_escape_string($a_row['area']))=="") print"\n"; else print"\n"; if ((mysql_real_escape_string($a_row['location']))=="") print"\n"; else print"\n"; if ($toggle=="all_dept") print"\n"; else print"\n"; print "\n"; } echo "
 Department: Last Name: First name: ext: Position: Area: Area: Location: Hours: Email:

".$a_row['last']."".$a_row['last']." ".$a_row['first']."".$a_row['pre']."-".$a_row['ext']."ext: ".$a_row['ext']." ".$a_row['position']." ".$a_row['area']." ".$a_row['location']." ".$a_row['hours']." ".$a_row['email']."
"; echo "
"; echo "
"; } ?>