Support » Plugin: WP Survey And Quiz Tool » [Plugin: WP Survey And Quiz Tool]: see ranking results

Viewing 2 replies - 1 through 2 (of 2 total)
  • I would like this as well.

    If you are comfortable in writing some simple PHP and MYSQL you can use something like this to get the fastest times. I use this query on one of my sites to display the three top contenders with the fastest times in a quiz.

    <?php
    global $wpdb;
    $res = $wpdb->get_results("SELECT DISTINCT(SEC_TO_TIME(timetaken)) AS thetime, person_name FROM wp_wpsqt_all_results ORDER BY thetime ASC LIMIT 0, 3");
    foreach ($res as $rs) {
      echo $rs->thetime . ' ' . $rs->person_name . '\n';
    }
    ?>

    The code above will show you the three fastest times and the names of the contestants.

    You could also display the users score amongst those details. To do this paste the following into your page:

    <?php
    global $wpdb;
    $res = $wpdb->get_results("SELECT DISTINCT(SEC_TO_TIME(timetaken)) AS thetime, person_name, score, total FROM wp_wpsqt_all_results ORDER BY thetime ASC LIMIT 0, 3");
    foreach ($res as $rs) {
      echo 'Time: ' . $rs->thetime . ' Name: ' . $rs->person_name . ' Score: ' . $rs->score . '/' . $rs->total . '\n';
    }
    ?>

    Hope this helps.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: WP Survey And Quiz Tool]: see ranking results’ is closed to new replies.