suche
Code: Alles auswählen
//
// Get all tipps and fill Top10
//
$sql = "SELECT sum(tipp_points) AS total_points, tipp_user FROM " . FORMEL_TIPPS_TABLE . "
GROUP BY tipp_user
ORDER BY total_points DESC LIMIT 5";
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query tipps', '', __LINE__, __FILE__, $sql);
}
$rank = 0;
while ($row = $db->sql_fetchrow($result)) {
$rank++;
$tipp_user_row = get_userdata($row['tipp_user']);
$tipp_username = $tipp_user_row['username'];
$template->assign_block_vars('top_tippers', array(
'TIPPER_NAME' => $tipp_username,
'RANK' => $rank,
'TIPPER_POINTS' => $row['total_points'])
);
}
$db->sql_freeresult($result);
Code: Alles auswählen
//
// Get all tipps and fill Top10
//
$dein_pokal_bild = "./images/formel/pokal.jpg"; // Hier dein Bild reinschreiben
$sql = "SELECT sum(tipp_points) AS total_points, tipp_user FROM " . FORMEL_TIPPS_TABLE . "
GROUP BY tipp_user
ORDER BY total_points DESC LIMIT 5";
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query tipps', '', __LINE__, __FILE__, $sql);
}
$rank = 0;
while ($row = $db->sql_fetchrow($result)) {
$rank++;
$user_rank = ( $rank == 1 ) ? '<img src="' . $dein_pokal_bild . '" />' : $rank;
$tipp_user_row = get_userdata($row['tipp_user']);
$tipp_username = $tipp_user_row['username'];
$template->assign_block_vars('top_tippers', array(
'TIPPER_NAME' => $tipp_username,
'RANK' => $user_rank,
'TIPPER_POINTS' => $row['total_points'])
);
}
$db->sql_freeresult($result);