separate the division and category from the main query so we can make sure we match up the div/cats with the proper FAIRYEAR

without using crazy joins and still making sure the record is displayed if no cat/div is specified yet
This commit is contained in:
james 2005-01-13 16:51:43 +00:00
parent de95ff761f
commit 1555f19293

View File

@ -31,13 +31,11 @@ else $wherestatus="";
registrations.num AS reg_num,
registrations.status,
projects.title,
projectcategories.category,
projectdivisions.division
projects.projectcategories_id,
projects.projectdivisions_id
FROM
registrations
left outer join projects on projects.registrations_id=registrations.id
left outer join projectcategories on projects.projectcategories_id=projectcategories.id
left outer join projectdivisions on projects.projectdivisions_id=projectdivisions.id
WHERE
1
$wherestatus
@ -46,6 +44,7 @@ else $wherestatus="";
projects.title
");
echo mysql_error();
echo "<table class=\"summarytable\">";
echo "<tr>";
echo "<th>".i18n("Status")."</th>";
@ -72,8 +71,17 @@ else $wherestatus="";
echo "<td>$status_text</td>";
echo "<td>$r->reg_num</td>";
echo "<td>$r->title</td>";
echo "<td>".i18n("$r->category")."</td>";
echo "<td>".i18n("$r->division")."</td>";
//now get thh category and division
$catq=mysql_query("SELECT category FROM projectcategories WHERE year='".$config['FAIRYEAR']."' AND id='".$r->projectcategories_id."'");
$catr=mysql_fetch_object($catq);
$divq=mysql_query("SELECT division FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' AND id='".$r->projectdivisions_id."'");
$divr=mysql_fetch_object($divq);
echo "<td>".i18n("$catr->category")."</td>";
echo "<td>".i18n("$divr->division")."</td>";
$sq=mysql_query("SELECT students.firstname,
students.lastname,