Thanks, Chen. I forgot about the double quotes. I was trying to do it with single quotes.
Is there an easier way to have it say like 1 day instead of 1 days than what I did here? Maybe a global way for all of the s variables instead of having to do them one at a time here?
PHP Code:
//Server Uptime Code
$result = mysql_query("show status");
while ($row = mysql_fetch_array($result)){
if ($row['Variable_name'] == "Uptime") { $uptime = $row['Value']; }
}
$days = ((($uptime/60)/60)/24);
$wholeday = (int) $days;
$a='s';
if (intval($wholeday)<1){
$wholeday=0;
}if (intval($wholeday)==1){
$a='';
}
$hours = (($days - $wholeday)*24);
$wholehour = (int) $hours;
$b='s';
if (intval($wholehour)<1){
$wholehour=0;
}if (intval($wholehour)==1){
$b='';
}
$minutes = (($hours - $wholehour)*60);
$wholeminute = (int) $minutes;
$c='s';
if (intval($wholeminute)<1){
$wholeminute=0;
}if (intval($wholeminute)==1){
$c='';
}
$seconds = (($minutes - $wholeminute)*60);
$wholesecond = (int) $seconds;
$d='s';
if (intval($wholesecond)<1){
$wholesecond=0;
}if (intval($wholesecond)==1){
$d='';
}
I had to use a,b,c,d for the variables because when I tried to do s for all of them, it wouldn't work.
PHP Code:
makelabelcode('Server Uptime', "$wholeday day$a, $wholehour hour$b, $wholeminute minute$c and $wholesecond second$d.");