firecamp Posted May 24, 2011 Posted May 24, 2011 Warning: Division by zero in /home/************/************l/**********/header.php on line 149 $enperc=(int) ($ir['energy']/$ir['maxenergy']*100); That's the line can anyone please help? Quote
Dayo Posted May 24, 2011 Posted May 24, 2011 is that inside a function if so have you got global $ir; before that? if not make sure $ir is set Quote
firecamp Posted May 24, 2011 Author Posted May 24, 2011 Function From what I can see it isn't inside a function. Quote
Dayo Posted May 24, 2011 Posted May 24, 2011 that should be in userstats() function if i remember correctly, try adding global $ir; above it Quote
firecamp Posted May 24, 2011 Author Posted May 24, 2011 error Still comes up with same error :( Quote
Blade Maker Posted May 24, 2011 Posted May 24, 2011 Okay so you see where it says: global $db,$c,$userid, $set; Make it: global $db,$c,$userid,$ir, $set; If that does not work, check the database, go to table users, and check the user you were logged in as, make sure the maxenergy is not 0. If it still does not work message me. Quote
Djkanna Posted May 25, 2011 Posted May 25, 2011 (edited) The error is in the text, you cannot use zero in a division. Try printing out both $ir['energy'] and $ir['maxenergy'] see what you get. Note to others: It's in the header.php, within the userdata function, there is no need to global $ir (obviously unless the op has changed something :D) Edited May 25, 2011 by Djkanna Quote
W3Theory || Peter Posted May 25, 2011 Posted May 25, 2011 maxenergy is most likely a 0. It wouldn't matter if $ir['energy'] was a 0, but if $ir['maxenergy'] is a 0 in the user table then that is why it is producing the error. Meaning you accidentally edited the database table for it, or it's not suppose to be named maxenergy and is named something else, or when you registered it didn't update the max energy. Those are my guesses. Quote
Blade Maker Posted May 25, 2011 Posted May 25, 2011 Okay for everyones information, this is fixed. Some of his files have V2 functions such as $db->fetch_row and all that. So authenticate was not accessing the database because of that, so therefore no id, therefore no output. There were a couple other errors as well, but that one solves the Devision by 0 Error. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.