PHP Classes

File: mysql_status.php

Recommend this page to a friend!
  Classes of Mac Dude   MySQL Server Status   mysql_status.php   Download  
File: mysql_status.php
Role: Example script
Content type: text/plain
Description: Example File
Class: MySQL Server Status
Retrieve and format MySQL server status values
Author: By
Last change:
Date: 20 years ago
Size: 1,292 bytes
 

Contents

Class file image Download
<?php
// replace the next line with your own connect scripts
   
include_once('config/connect.php');
   
   
// include the class
   
include('mysql_status.inc');
// create a new instance of the class
   
$ServerStatus = new MySQLServerStatus;
$current_status = $ServerStatus->GetServerStatus();
   
// use : GetServerStatus()
    // returns an array of the MySQL Server Status values
    // see the MySQL documentation to get a list of the parameters
    // example
    // $status=GetServerStatus()
    // $uptime=$status['Uptime'];
    // $bytes_rcvd=$status['Bytes_received'];
    // combine them with the Formatbytes function:
    // $value=Formatbytes($status['Bytes_received'];
    // $value=$ServerStatus->Formatbytes($current_status['Bytes_received'],3);
    // echo $value['value'] . " " . $value['format'];
   
   
$value=$ServerStatus->Formatbytes($current_status['Bytes_received'],3);
   
// use : Formatbytes(the value, number of decimal places)
    // byte value = $value['value']
    // Format:
    // TB = Terabyte
    // GB = Gigabyte
    // MB = Megabyte
    // KB = Kilobyte
    // $value['format']
   
   
$value=$ServerStatus->TimeSpanFormat($current_status['Uptime']);
   
// use : TimeSpanFormat(number of seconds)
    // days = $value['Days']
    // hours = $value['Hours']
    // minutes = $value['Minutes']
    // seconds = $value['Seconds']
?>