From b26d9a3dc45c75939fabe840eac7ef151e0d3318 Mon Sep 17 00:00:00 2001 From: james Date: Sat, 5 Mar 2011 03:13:15 +0000 Subject: [PATCH] Fix school list --- common.inc.functions.php | 7 +++++-- user_school.php | 7 +++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/common.inc.functions.php b/common.inc.functions.php index 43333bc..41f707f 100644 --- a/common.inc.functions.php +++ b/common.inc.functions.php @@ -847,12 +847,15 @@ function get_special_awards($conferenceId){ function get_schools($conferenceId){ $data = array(); $returnval = array(); - $q = mysql_query("SELECT MAX(id) AS id, school, city FROM schools GROUP BY school, city"); - while($record = mysql_fetch_assoc($q)) $data[] = $record; + //$q = mysql_query("SELECT MAX(id) AS id, school, city FROM schools GROUP BY school, city"); + $q = mysql_query("SELECT * FROM schools WHERE conferences_id='{$conferenceId}' ORDER BY school"); + while($record = mysql_fetch_assoc($q)) + $data[] = $record; $prevRecord = null; for($n = 0; $n < count($data); $n++){ $record = $data[$n]; $title = $data[$n]['school']; + //if there's more with the same name, add the city if(array_key_exists($n + 1, $data) && $data[$n + 1]['school'] == $title){ $title .= " ({$record['city']})"; }else if($prevRecord != null && $prevRecord['school'] == $title){ diff --git a/user_school.php b/user_school.php index 77431d4..45cdd0f 100644 --- a/user_school.php +++ b/user_school.php @@ -89,6 +89,13 @@ $translations = array( // draw the info area echo "

" . i18n("School Information") . "

"; $currentSchool = $u['schools_id']; +if($currentSchool){ + $q=mysql_query("SELECT * FROM schools WHERE id='$currentSchool' AND conferences_id='{$conference['id']}'"); + if(!mysql_num_rows($q)) { + echo "Your current school selection is invalid. Please select your school"; + $currentSchool=null; + } +} if($currentSchool){ echo i18n("You are currently listed as a member of") . "
"; echo '
';