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.
Not a member yet? Click here to register.
Forgot Password?

Division by zero in maincore.php?

Asked Modified Viewed 2,422 times
R
Reflectoman
R
------------------------------------------------
Adnan Ahmed Online
File Hosting | Image Hosting | Free SMS
  • Member, joined since
  • Contributed 176 posts on the community forums.
  • Started 9 threads in the forums
  • Started this discussions
asked
Member

I have noticed the following warning at the bottom of some of my pages ... Warning: Division by zero in /var/www/mucus/maincore.php on line 570

in my maincore.php this is the code that surrounds line 570, the line itself is in red... the variable $count is not found anywhere else in the page .. i even checked the version in the CVS browser here, and it matches .. so i'm not sure how $count is set to a number and why now i'm getting a division by zero warning. it may that its been there for a while, but i just noticed it now ... its not affecting anything on the page, so i guess its not crucial! i have the makepagenav function used in some other custom pages, and the warning is NOT shown on those pages ... its only on the news archive page.

like always, thanx for ur help!



function makepagenav($start,$count,$total,$range=0,$link=""){
   global $locale;
   if ($link == "") $link = FUSION_SELF."?";
   $res="";
   [color=red]$pg_cnt=ceil($total / $count);[/color]
   if ($pg_cnt > 1) {
      $idx_back = $start - $count;
      $idx_next = $start + $count;
      $cur_page=ceil(($start + 1) / $count);
      $res.="<table cellspacing='1' cellpadding='1' border='0' class='tbl-border'>\n<tr>\n";
      $res.="<td class='tbl2'><span class='small'>".$locale['052']."$cur_page".$locale['053']."$pg_cnt</span></td>\n";
      if ($idx_back >= 0) {
         if ($cur_page > ($range + 1)) $res.="<td class='tbl2'><a class='small' href='$link"."rowstart=0'><<</a></td>\n";
         $res.="<td class='tbl2'><a class='small' href='$link"."rowstart=$idx_back'><</a></td>\n";
      }
      $idx_fst=max($cur_page - $range, 1);
      $idx_lst=min($cur_page + $range, $pg_cnt);
      if ($range==0) {
         $idx_fst = 1;
         $idx_lst=$pg_cnt;
      }
      for($i=$idx_fst;$i<=$idx_lst;$i++) {
         $offset_page=($i - 1) * $count;
         if ($i==$cur_page) {
            $res.="<td class='tbl1'><span class='small'><b>$i</b></span></td>\n";
         } else {
            $res.="<td class='tbl1'><a class='small' href='$link"."rowstart=$offset_page'>$i</a></td>\n";
         }
      }
      if ($idx_next < $total) {
         $res.="<td class='tbl2'><a class='small' href='$link"."rowstart=$idx_next'>></a></td>\n";
         if ($cur_page < ($pg_cnt - $range)) $res.="<td class='tbl2'><a class='small' href='$link"."rowstart=".($pg_cnt-1)*$count."'>>></a></td>\n";
      }
      $res.="</tr>\n</table>\n";

   }
   return $res;
}


Admin Note: Please turn off smiley when posting code
Edited by shedrock on 26-02-2006 22:10,
0 replies

9 posts

F
Falk
F
Falk 131
Need help?, Having trouble?
• View our Documentation for Guides, Standards and Functions
• Name and Organize your Topics and Content correctly in the corresponding Forums for best support results
• Attaching Log Files and Screenshots when reporting issues will help
• Provide with an URL to live example if one exists
• Please read the How to Report an Error post
• Please read and comply with the Code of Conduct

(¯·._.·(¯°·._.·°º*[ Project Manager ]*º°·._.·°¯)·._.·¯)
  • Super Admin, joined since
  • Contributed 6,201 posts on the community forums.
  • Started 639 threads in the forums
  • Answered 11 questions
answered
Super Admin

News Archive?
0 replies
S
shedrock
S
phpfusion-themes.com/siriuslogo.jpg
  • Senior Member, joined since
  • Contributed 232 posts on the community forums.
  • Started 10 threads in the forums
answered
Senior Member

I think he is referring to the news_archive mod Digi. If so, then he needs to visit the MOD site for an updated version. ;)

Shedrock
0 replies
R
Reflectoman
R
------------------------------------------------
Adnan Ahmed Online
File Hosting | Image Hosting | Free SMS
  • Member, joined since
  • Contributed 176 posts on the community forums.
  • Started 9 threads in the forums
  • Started this discussions
answered
Member

yes i was referring to the mod, and sorry i posted on the wrong site .. :(

but thanx for the heads up shedrock .... and i'll try to keep track of where im posting for next time ... ;)
0 replies
— 3 months later —
R
riomas
R
riomas 10
PHP-Fusion community Lithuanian

http://php-fusion.lt/news.php
  • Junior Member, joined since
  • Contributed 36 posts on the community forums.
  • Started 8 threads in the forums
answered
Junior Member

Quote

Foto albumai
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3

Warning: Division by zero in /home/phpfusion/domains/php-fusion.lt/public_html/maincore.php on line 528
0 replies
R
riomas
R
riomas 10
PHP-Fusion community Lithuanian

http://php-fusion.lt/news.php
  • Junior Member, joined since
  • Contributed 36 posts on the community forums.
  • Started 8 threads in the forums
answered
Junior Member

this slip-up may co-located hosting

Quote

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3
0 replies
R
riomas
R
riomas 10
PHP-Fusion community Lithuanian

http://php-fusion.lt/news.php
  • Junior Member, joined since
  • Contributed 36 posts on the community forums.
  • Started 8 threads in the forums
answered
Junior Member

error not

Quote

Warning: Division by zero in /home/phpfusion/domains/php-fusion.lt/public_html/maincore.php on line 528


though this though

http://php-fusion.lt/photogallery.php

Quote

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3

0 replies
F
Falk
F
Falk 131
Need help?, Having trouble?
• View our Documentation for Guides, Standards and Functions
• Name and Organize your Topics and Content correctly in the corresponding Forums for best support results
• Attaching Log Files and Screenshots when reporting issues will help
• Provide with an URL to live example if one exists
• Please read the How to Report an Error post
• Please read and comply with the Code of Conduct

(¯·._.·(¯°·._.·°º*[ Project Manager ]*º°·._.·°¯)·._.·¯)
  • Super Admin, joined since
  • Contributed 6,201 posts on the community forums.
  • Started 639 threads in the forums
  • Answered 11 questions
answered
Super Admin

Quote

riomas wrote:

Quote

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3



Its difficult to diagnose, can you create a full admin account for me? pm me access info.
0 replies
R
riomas
R
riomas 10
PHP-Fusion community Lithuanian

http://php-fusion.lt/news.php
  • Junior Member, joined since
  • Contributed 36 posts on the community forums.
  • Started 8 threads in the forums
answered
Junior Member

it is all over bar the shouting OK thanks ;)
0 replies
B
Bad Boy
B
____________________
BadBoy aka GoogleDude
http://www.googlecityforums.com
  • Member, joined since
  • Contributed 155 posts on the community forums.
  • Started 1 thread in the forums
answered
Member

Quote

TammyK wrote:
It's still something that should be protected against.

Adding:

 
if(empty($count)) return;


Directly above:


$pg_cnt=ceil($total / $count);


should keep the function from throwing that error.


This gets rid of this error:

Quote

Warning: Division by zero in /home/googleci/public_html/maincore.php on line


But this one still remains...

Quote

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3
0 replies

Category Forum

Bugs and Errors - 6

Labels

None yet

Statistics

  • Views 0 views
  • Posts 9 posts
  • Votes 0 votes
  • Topic users 5 members

0 participants

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet