Mercurial > hg > fapweb
view results.inc.php @ 0:8019b357cc03
Initial import.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 04 Dec 2012 19:07:18 +0200 |
parents | |
children | 916623924bd5 |
line wrap: on
line source
<? echo "<h1>Results</h1>\n"; if (($res = stExecSQL("SELECT * FROM compos ORDER BY name DESC")) !== FALSE) foreach ($res as $compo) { $sql = "SELECT DISTINCT SUM(votes.value) AS votesum,entries.*,votes.* ". "FROM entries LEFT JOIN votes ON entries.id=votes.entry_id ". "WHERE entries.compo_id=".$compo["id"]." ORDER BY ". ($showResults ? "entries.id" : "votesum")." ASC"; echo "<h2>".$compo["name"]."</h2>\n". "<table class=\"attendees\" style=\"width: 80%;\">\n". " <tr>\n". " <th style=\"width: 1%;\">#</th>\n". " <th style=\"width: 3%;\">Points</th>\n". " <th>Name</th>\n". " <th>Author</th>\n". " </tr>\n"; $index = 1; if (($fres = stExecSQL($sql)) !== FALSE) foreach ($fres as $entry) { echo "<tr>". "<td>".($showResults ? "#".$index : "")."</td>". "<td>".($showResults ? $entry["votesum"] : "?")."</td>". "<td>".chentities($entry["name"])."</td>". "<td>".($showAuthors ? chentities($entry["author"]) : "-")."</td>". "</tr>\n"; } echo "</table>\n"; } ?>