WordPress.org

Ready to get started?Download WordPress

Forums

Watu
[resolved] Watu output error (4 posts)

  1. defango
    Member
    Posted 1 year ago #

    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?

    Error

    Warning: Division by zero in /home/defken/defango.com/wp-content/plugins/watu/show_exam.php on line 76

    link to test

    http://defango.com/low-t/

    lines from show_exam.php

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

    $result .= "</div>";
    //$total++;
    }
    $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!

    http://wordpress.org/extend/plugins/watu/

  2. prasunsen
    Member
    Plugin Author

    Posted 1 year ago #

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

  3. defango
    Member
    Posted 1 year ago #

    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.

  4. prasunsen
    Member
    Plugin Author

    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags