Jump to content
MakeWebGames

Recommended Posts

Posted

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?

Posted

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.

Posted (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 by Djkanna
Posted

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.

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...