- 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 6 Replies. [971], Last Updated: Sat May 18, 2024
unix
Fri Nov 17, 2006
6 Comments
14493 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
-David
h