function display_results($token)
{
    $rank = retrieve_results($token);
    $total_step = get_steps();
    $first = key($rank);
    $desc = get_description($first);
    echo '<p>Tu es donc <strong> ' . $first . '<strong><p><p class="hero_desc">' . $desc . '</p>';
    echo '<p>Plus de détails : </p>';
    foreach ($rank as $key => $profile) {
        $percent = round($profile / $total_step * 100);
        echo 'Tu es à ' . $percent . ' % ' . $key . '<br/>';
    }
}
Example #2
0
<?php

session_start();
$rank = retrieve_results($_SESSION["token"]);
$first_key = array_keys($rank)[0];
// We add to the database the result
add_to_result_list($first_key, $_SESSION["token"]);
$total_step = get_steps();
$infos = array();
foreach ($rank as $id => $value) {
    $infos[] = get_informations($id);
}