Jump to content

Recommended Posts

Here's what I came up with:

$percent         = ("total_uptime" / ("total_uptime" + "total_downtime")) * 100;

Where total total_uptime starts at 1 and total_downtime at 0...I've create a cron job to automatically add one to uptime if the server is up and if down add one to down. But I'm getting this message:

Warning: Division by zero in [path]\modules\server_status\index.php on line 262

If anyone could either correct my math or help me find a different way to do this I'd very much appreciate it.

PS: The total_uptime and total_downtime are rows in my mysql database.

Link to comment
https://forums.phpfreaks.com/topic/118185-solved-percent-of-uptime/
Share on other sites

I don't think your seeing the problem. total_uptime and total_downtime are not numbers! Maybe if you where using the variables $total_uptime and $total_downtime that you defined somewhere previously but at the moment there just strings when within quotes or undefined constants when outside of them.

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.