diff --git a/winners.php b/winners.php index 2bb737f2..5541966b 100644 --- a/winners.php +++ b/winners.php @@ -50,6 +50,7 @@ if (get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type')) echo '

' . i18n('%1 ' . $type . ' Award Winners', array($_GET['year'])) . '

'; $ok = true; + // first, lets make sure someone isnt tryint to see something that they arent allowed to! // but only if the year they want is the FAIRYEAR. If they want a past year, thats cool if ($_GET['year'] >= $config['FAIRYEAR']) { @@ -73,9 +74,9 @@ if (get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type')) award_types WHERE award_awards.year='$year' - AND\taward_awards.award_types_id=award_types.id - AND\taward_types.type='$type' - AND\taward_types.year='$year' + AND award_awards.award_types_id=award_types.id + AND award_types.type='$type' + AND award_types.year='$year' ORDER BY awards_order"); @@ -85,7 +86,40 @@ if (get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type')) if ($q->rowCount()) { echo '' . i18n('Back to Winners main page') . ''; echo '
'; + while ($r = $q->fetch(PDO::FETCH_OBJ)) { + $pq = $pdo->prepare("SELECT + award_prizes.prize, + award_prizes.number, + award_prizes.id, + award_prizes.cash, + award_prizes.scholarship, + winners.projects_id, + projects.projectnumber, + projects.title, + projects.registrations_id AS reg_id + FROM + award_prizes + LEFT JOIN winners ON winners.awards_prizes_id=award_prizes.id + LEFT JOIN projects ON projects.id=winners.projects_id + WHERE + award_awards_id='$r->id ' + AND award_prizes.year='$year' + ORDER BY + `order`"); + + $pq->execute(); + show_pdo_errors_if_any($pdo); + $awarded_count = 0; + if ($show_unawarded_awards == 'no') { + while ($pr = $pq->fetch(PDO::FETCH_OBJ)) { + if ($pr->projectnumber) { + $awarded_count++; + } + } + + // $pq->fetch(PDO::FETCH_ORI_ABS, 0); + } $pq = $pdo->prepare("SELECT award_prizes.prize, award_prizes.number, @@ -105,18 +139,9 @@ if (get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type')) AND award_prizes.year='$year' ORDER BY `order`"); + $pq->execute(); - show_pdo_errors_if_any($pdo); - $awarded_count = 0; - if ($show_unawarded_awards == 'no') { - while ($pr = $pq->fetch(PDO::FETCH_OBJ)) { - if ($pr->projectnumber) { - $awarded_count++; - } - } - - $pq->fetch(PDO::FETCH_ORI_ABS, 0); - } + if ($show_unawarded_awards == 'yes' || $awarded_count > 0) { echo '

' . i18n($r->name) . "

\n"; }