Přidat otázku mezi oblíbenéZasílat nové odpovědi e-mailemVyřešeno PHP/MySQL - Pořadí do tabulky

Vždyť to tam máš...

// Allow sorting to occur
if (isset($_GET['sort'])) {
    $standings_sort = intval($_GET['sort']);
}
else {
    $standings_sort = 0;
}
switch ($standings_sort) {
/*
Available sort fields:

Name: teamname
Wins: teamwins
Losses: teamlosses
Ties: teamties
Forfeits: teamforfeits
Runs for: teamrf
Runs against: teamra
Games behind: gamesbehind
Points: points
Winning percentage: winningpct
Custom tie break: teamorder

Separate the fields by commas and always specify a sort order as DESC for descending and ASC for ascending
*/
case 1: // Sort by team name
$sort_order = "teamname ASC"; break;
case 2: // Sort by wins
$sort_order = "teamwins DESC, teamties DESC, teamlosses ASC, teamorder DESC"; break;
case 3: // Sort by losses
$sort_order = "teamlosses DESC, teamwins ASC, teamties ASC, teamorder DESC"; break;
case 4: // Sort by ties
$sort_order = "teamties DESC, teamwins DESC, teamlosses ASC, teamorder DESC"; break;
case 5: // Sort by forfeits
$sort_order = "teamforfeits DESC, teamwins ASC, teamties ASC, teamorder DESC"; break;
case 6: // Sort by games played
$sort_order = "gamesplayed DESC, teamwins DESC, teamties DESC, teamlosses ASC, teamorder DESC"; break;
case 7: // Sort by runs for
$sort_order = "teamrf DESC, teamwins ASC, teamties DESC, teamlosses ASC, teamorder DESC"; break;
case 8: // Sort by runs against
$sort_order = "teamra DESC, teamwins DESC, teamties ASC, teamlosses DESC, teamorder DESC"; break;
case 9: // Sort by games behind
$sort_order = "gamesbehind ASC, teamties DESC, teamwins DESC, teamlosses ASC, teamorder DESC"; break;
case 10: // Sort by points
$sort_order = "points DESC, teamwins DESC, winningpct DESC, teamorder DESC"; break;
default: // Sort by winning percentage
$standings_sort = 0; $sort_order = "winningpct DESC, teamorder DESC";
}
$division_sort = "";

Reakce na odpověď

1 Zadajte svou přezdívku:
2 Napište svou odpověď:
3 Pokud chcete dostat ban, zadejte libovolný text:

Zpět do poradny