Support » Plugin: Watu Quiz » Watu output error

  • Resolved defango


    I loaded up your plugin looking to make some tests for a friend that was looking into using you plugin for it. Everything went really smooth, I really loved the easy of usage. I ran into an error after I tested my first tests an saw I was getting a “divide by zero” errer just above the results. is this common or have I messed the settings?


    Warning: Division by zero in /home/defken/ on line 76

    link to test

    lines from show_exam.php

    $result .= “”;
    if(!$_REQUEST[“answer-” . $ques->ID]) $result .= “<p class=’unanswered’>” . __(‘Question was not answered’, ‘watu’) . “</p>”;

    $result .= “</div>”;
    $total = $wpdb->get_var($wpdb->prepare(“SELECT sum(point) FROM {$wpdb->prefix}watu_question as q inner join {$wpdb->prefix}watu_answer as a on question_id=q.ID WHERE exam_id=%d and correct=’1′ “, $exam_id));

    //Find scoring details of this guy.
    $percent = number_format($score / $total * 100, 2);
    //0-9 10-19%, 20-29%, 30-39% 40-49%
    $all_rating = array(__(‘Failed’, ‘watu’), __(‘Failed’, ‘watu’), __(‘Failed’, ‘watu’), __(‘Failed’, ‘watu’), __(‘Just Passed’, ‘watu’),

    any help would be great!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author prasunsen


    problem solved in 1.6.3. But in general you shouldn’t have exam with 0 points on all questions.

    Yea, there isn’t zero points on any of the questions, so there is probably a coding error. I downloaded and uploaded with your instructions and was smart enough to give each question a value.

    Plugin Author prasunsen


    There is no coding error, this plugin is used by near 5,000 users and you are the first who has such problem. The “Division by zero” warning means only one thing – that there is a division by zero.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Watu output error’ is closed to new replies.