- Forums
- PHP
- How To Fix Warning: Division by zero in /var/html/public/phpf.php on line 3
This Page Contains information about How To Fix Warning: Division by zero in /var/html/public/phpf.php on line 3 By unix in category PHP with 2 Replies. [1834], Last Updated: Mon Jun 24, 2024
unix
Fri Feb 29, 2008
2 Comments
404 Visits
ok, today i will try to show you why you are getting this error, as i was also getting it and this is what i did to solve it (fix it)
1. on line 3 on my phpf.php file i had:
Code:$pagid=($_GET[pagid] / $pagid_decorder);
2. However, when i changed it to a number manually i didn't get the error anymore: i change line 3 to:
Code:$pagid=($_GET[pagid] / 651);
3. After i changed it to an intiger (978) number, it worked without the error, so this tells me there is a problem with the declaration of the $pagid_decorder integer, so i need to check where i declare it. I found the file where i declare this integer and it said:
Code:$pagid_decoder=651;
6. You see what the problem is, i have mispelled pagid_decoder to pagid_decorder. ( i put an extra "r" after the letter o)
7. After I corrected this, my script worked like a charm and i didn't get the error anymore. so basically, if you are also getting this error and wondering why you are getting it, its because you may have a mispelled word.
8. However, if you checked and you have the correct spelling of the variable, then you have to look at the error, you are infact dividing by zero. which means, you have not declared the variable, in other words, the variable has no value its NULL.
9. hope this helps
Warning: Division by zero in
https://www.webune.com/forums/how-to-fix-warning-division-by-zero-in-var-html-public-phpfphp-on-line-3-t478.html