Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

VArcade errors

I've got a lot of warnings which are Division by zero

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]<p><?php echo $locale['VOT306']; ?> <strong> <?php echo @number_format($current_rating/$count,1) ?></strong><?php echo $locale['VOT302']; ?>
<?php echo $count ?> <?php echo $tense ?> [/syntaxhighlighter]

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]@$rating = number_format($current_rating/$count,1);[/syntaxhighlighter]

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false] <li class='current-rating' style="width:<?php echo @number_format($current_rating/$count,2)*16; ?>px;"></li>[/syntaxhighlighter]

Please help me to fix this stupid things.
What are the errors exactly shown as ?
For this 3 lines they show error division by zero.
It means that $count is 0 and hence it is giving this error.

Try Replacing :
CodeDownload  
echo @number_format($current_rating/$count,1)


with :
CodeDownload  
echo ($count == 0 ? $current_rating : number_format($current_rating/$count,1))



And :
CodeDownload  
@$rating = number_format($current_rating/$count,1);


with :
CodeDownload  
@$rating = ($count == 0 ? $current_rating : number_format($current_rating/$count,1));



and :
CodeDownload  
echo @number_format($current_rating/$count,2)*16;


with :
CodeDownload  
echo  ($count == 0 ? $current_rating*16 : number_format($current_rating/$count,2)*16);

Its been fixed for VArcade 3.0 aswell , and the silly php openings and closeings are also gone.
The @ before was used to supress the error messages there, not sure what changed to not supress them now.
Thread Information
Author
Replies
5 posts
Views
2,390 times
Last Post
Last updated on 8 years ago
You can view all discussion threads in this forum.
You cannot set up a bounty in this discussion thread.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
Users who participated in discussion: Falk, Wyciokazz, Ankur