Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
6.9k views
in Q2A Core by
Q2A version: 1.5.3
by
Could you be a bit more helpful please?
- When does the error occur, what pages?
- Does it occur every time or just occasionally?
- Does it occur on a specific action, e.g. asking a question?

Try removing some plugins and see if it fixes it, then you will know if it's a plugin or something else. Also try a different theme.
by
In question's meta, which asked in several minutes ago.

function qa_time_to_string($seconds)
/*
    Return textual representation of $seconds
*/
    {
        if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
       
        $seconds=max($seconds, 1);
       
        $scales=array(
            31557600 => array( 'main/1_year'   , 'main/x_years'   ),
             2629800 => array( 'main/1_month'  , 'main/x_months'  ),
              604800 => array( 'main/1_week'   , 'main/x_weeks'   ),
               86400 => array( 'main/1_day'    , 'main/x_days'    ),
                3600 => array( 'main/1_hour'   , 'main/x_hours'   ),
                  60 => array( 'main/1_minute' , 'main/x_minutes' ),
                   1 => array( 'main/1_second' , 'main/x_seconds' ),
        );
       
        foreach ($scales as $scale => $phrases)
            if ($seconds>=$scale) {
                $count=floor($seconds/$scale);
           
                if ($count==1)
                    $string=qa_lang($phrases[0]);
                else
                    $string=qa_lang_sub($phrases[1], $count);
                   
                break;
            }
           
        return $string;
    }
by
still this problem exists? I am also facing same issue, when a new user asked a question. Another guy recently joined and asked question, but there it is working fine.. Showing only for "one" user.

2 Answers

+3 votes
by
selected by
 
Best answer

The solution for this is pretty simple.

In the accept rate plugin there is a file named qa-accept-layer.php, open the file and go to line 38. you will see the following code.

    $rate = round($accepted/$total*100);

The error is caused because it is dividing the value by 0. To stop this warning from showing, you must suppress the round function with the error supression operator @.

    $rate = @round($accepted/$total*100);

Change the code as shown above, and every thing should be working fine.

by
I had the same problem with my site and tried your method and it works like a charm.

Thanks for the answer :-)
by
Where I  can find the qa-accept-layer.php file?
+1 vote
by

Hello,

I found an answer for this. As one of my user complained about this, I was able to find out the reason rather than the exact solution.

here is the link to the discussion: http://qstacks.com/?qa=64/warning-division-home-public_html-include-format-1466-code

The problem is related to the conflict of Accept Rates of User Plugin of Q2A. When you disable that plugin (or uncheck on "Show accept rate below user meta" of the plugin page) You will no longer get this error. I hope the plugin author will resolve this issue asap.

by
I tried your method as well as the method in the answer above, and both worked like a charm.

Disabling the plugin is a good idea, but if you can actually fix the problem, you can use the plugin without any issues.
...