Cronwerks MCCode/MCCodes Forums

Please login or register.

Login with username, password and session length

News:

Register your account to receive email notifications when new services and mods are added.


This forum is now closed and has moved to a new location! Click here to find out why.

AuthorTopic: Divisions of 0  (Read 270 times)

Aderik

  • Basic Member
  • *
  • Reputation Power: 2
  • Aderik has no influence.
  • Offline Offline
  • Posts: 1
    • View Profile
Divisions of 0
« on: October 01, 2010, 01:00:02 PM »
Edit: My apologies, I worked it myself after 2 hours of fiddling and a good night's sleep.
Edit2: Oks, I worked out where the top code goes, but it's still saying there's a division of 0 in my lines. I'm not understanding still...


I'm working on a new game and I wanted to add some new stats

I worked around and found this post

The message


I tried everything suggested except this

Code: [Select]
ALTER TABLE `users` ADD `fatigue` int(11) NOT NULL DEFAULT '0'

ALTER TABLE `users` ADD `maxfatigue` int(11) NOT NULL DEFAULT '100'

I am not sure where it would go, it's not specified.

I also added a second line for 'Troops'

However when I look at the index page I see this



Warning: Division by zero in /home/brogan/public_html/header.php on line 220

Warning: Division by zero in /home/brogan/public_html/header.php on line 221

Code: [Select]
$faterc=(int) ($ir['fatigue']/$ir['maxfatigue']*100);
$trperc=(int) ($ir['troops']/$ir['maxtroops']*100);


Is it my coding for the troops or my lack of the top code? If so where would I put that code?

Much appreciative for any help.
« Last Edit: October 02, 2010, 05:43:51 AM by Aderik »
Logged
 


This forum is now closed and has moved to a new location! Click here to find out why.