Exemple #1
0
                $req->execute();
            } else {
                $req->execute(array('type' => $_GET['type']));
            }
            $search_type = 'items';
        }
        // BEGIN DISPLAY RESULTS
        if ($req->rowCount() === 0) {
            display_message('error_nocross', _("Sorry. I couldn't find anything :("));
        } else {
            while ($get_id = $req->fetch()) {
                $results_arr[] = $get_id['id'];
            }
            // sort by id, biggest (newer item) comes first
            $results_arr = array_reverse($results_arr);
            $total_time = get_total_time();
            ?>
            <!-- Export CSV/ZIP -->
            <div class='align_right'>
                <a name='anchor'></a>
                <p class='inline'><?php 
            echo _('Export this result:');
            ?>
 </p>
                <a href='make.php?what=zip&id=<?php 
            echo Tools::buildStringFromArray($results_arr);
            ?>
&type=<?php 
            echo $search_type;
            ?>
'>
function get_leaderboard($mysqli)
{
    $names = ["Amir", "August", "Blake", "Bob", "Charlie", "Clayton", "DeRon", "Ehan", "Jackson", "Josh", "Julian", "Justin", "Kendall", "Kristin", "Matt", "Megan", "Michel", "Niema", "Sidd", "Sophia", "Wilson"];
    $scores = [];
    $itera = 0;
    while ($itera < count($names)) {
        $scores[$names[$itera]] = get_total_time($names[$itera], $mysqli);
        $itera = $itera + 1;
    }
    arsort($scores);
    $itera = 0;
    foreach ($scores as $key => $val) {
        if ($itera < 5) {
            echo "<li>" . "{$key} {$val}" . "</li>";
        }
        $itera = $itera + 1;
    }
}