Wow nice, looks realy diffrent from my script but it look's like the % is counting wrong.
Are im wrong?
I feal lost on your script! it sow good, i't will take me a day or 2 to know how i't works but is good and clean i see and that should you take credit for 😃..
<?
include ("../management/connectdb/mysqlcondblg.php");
//changed to 1 because my test script doesn't have the session id
$sql = "SELECT gkpost_total,mlpost_total,fmpost_total,lkpost_total FROM ranglog WHERE usernameID='$_SESSION[regid]'";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
//The requerments for the ranks!
$required = array (
'gkpost_total'=>150,
'mlpost_total'=>75,
'fmpost_total'=>30,
'lkpost_total'=>7,
'ln_total'=>7
);
//display names of the fields
$names = array (
'gkpost_total' => 'Guestbook',
'mlpost_total'=>'Mail',
'fmpost_total'=>'Forum',
'lkpost_total'=>'Logbook',
'ln_total'=>'Login'
);
$result = array(); //holds the results column
$posts = array(); //holds the posts column
$colors = array(); //holds the font tags
$ends = array(); //holds the end font tags
foreach(array_keys($row) as $key) {
$result[$key] = ($row[$key]/$required[$key]) * 100;
if($row[$key] >= $required[$key]) {
$posts[$key] = $names[$key] . ' mastering.';
$colors[$key] = '<font color="green">';
$ends[$key] = '</font>';
} else {
$posts[$key] = $names[$key];
$colors[$key] = '';
$ends[$key] = '';
} //end if
if(strlen($result[$key]) <= 5 || strlen($result[$key]) >= 3)
$result[$key] = round($result[$key],2);
} //end foreach
$reset_date = time() + ((date('t') - date('j')) * 86400);
if(date('t') == date('j'))
$reset_date += 86400;
$co = '<font style="color: red;"><b>';
$co1 = '<font></b>';
?>
<table width="325" border="0" cellpadding="0" cellspacing="0" align="left">
<tr>
<td align="left" height="25" width="80" colspan="3"><b>Rank info:</b></td>
</tr>
<tr>
<td align="left" height="25" width="150" colspan="3">
The rank log will be reset
<?php echo date('M d, Y',$reset_date) . ' 12:00 am'?>
</td>
</tr>
<td width="100%" colspan="3"><hr noshade></td>
</tr>
<!-- took this out because I don't have the $nrow variable set up
<tr>
<td align=left class="bold" height=25 width="30">Username: </td>
<td width="130" class="bold"><?php /*echo $nrow['username']*/;?></td>
</tr>
-->
<tr>
<td height="25" width="150" align=left class="bold">Rank's:</td>
<td width="100" class="bold">Have Gained:</td>
<td width="75" class="bold">Needed:</td>
</tr>
<td width="100%" colspan="3"><hr noshade></td>
</tr>
<?php foreach(array_keys($row) as $key) { ?>
<tr>
<td height="30" align="left" class="bold">
<? echo $colors[$key] . $posts[$key] . $ends[$key] ?>
</td>
<td class="bold"><? echo $co . $result[$key] . "%" . $co1 ?></td>
<td class="bold">100%</td>
</tr>
<?php }?>
<tr>
<td width="100%" colspan="3"><hr noshade></td>
</tr>
</table>