ti_nhatrang
06-24-2008, 07:21 AM
Hello all,
not sure what I'm missing here... trying to see if the $leftmins is under the 70% mark of the total minutes used or not, if it is under, then print $call... not sure what i'm missing, please help:
$result = mysql_query("select * from customerdb WHERE active='1' order by active desc ,name") or die(mysql_error());
while ($row = mysql_fetch_assoc($result)) {
$count++;
if ($row['OSID']=="") {
$remain[]=$row['total']-$row['totalused']."|".$row['id']; // add it up for SORT() later
$tu[]=$row['total'];
$tt[]=round($row['total'] * .70);
$ids[$row['id']]=$row['name']; // save the names in an array for ref by ID
}
}
sort($remain); // put it in order by remaining
$data = "<b>Max Concurrent Calls: </b>".$max." on ".$maxdate."<br><br>";
$data .= "<table cellpadding=0 cellspacing=3>";
$data .= "<tr><td style='padding-right:20px;'><b>Customer</b></td>";
$data .= "<td><b>Time Left</b></td></tr>";
foreach ($remain as $value) {
$info = explode("|",$value);
$leftmins = floor(($info[0])/60);
$leftsecs = str_pad(abs(($info[0])%60), 2, "0", STR_PAD_LEFT);
if ($leftmins <"$tu-tt") { $call = "hahaha"; }
$data .= "<tr><td><a href='http://".$_SERVER['HTTP_HOST']."/customers/numbers/?id=".$info[1]."'>".$ids[$info[1]]."</a></td><td>".$leftmins.":".$leftsecs."</td><td>".$call."</td></tr>";
}
$data .="</table>";
not sure what I'm missing here... trying to see if the $leftmins is under the 70% mark of the total minutes used or not, if it is under, then print $call... not sure what i'm missing, please help:
$result = mysql_query("select * from customerdb WHERE active='1' order by active desc ,name") or die(mysql_error());
while ($row = mysql_fetch_assoc($result)) {
$count++;
if ($row['OSID']=="") {
$remain[]=$row['total']-$row['totalused']."|".$row['id']; // add it up for SORT() later
$tu[]=$row['total'];
$tt[]=round($row['total'] * .70);
$ids[$row['id']]=$row['name']; // save the names in an array for ref by ID
}
}
sort($remain); // put it in order by remaining
$data = "<b>Max Concurrent Calls: </b>".$max." on ".$maxdate."<br><br>";
$data .= "<table cellpadding=0 cellspacing=3>";
$data .= "<tr><td style='padding-right:20px;'><b>Customer</b></td>";
$data .= "<td><b>Time Left</b></td></tr>";
foreach ($remain as $value) {
$info = explode("|",$value);
$leftmins = floor(($info[0])/60);
$leftsecs = str_pad(abs(($info[0])%60), 2, "0", STR_PAD_LEFT);
if ($leftmins <"$tu-tt") { $call = "hahaha"; }
$data .= "<tr><td><a href='http://".$_SERVER['HTTP_HOST']."/customers/numbers/?id=".$info[1]."'>".$ids[$info[1]]."</a></td><td>".$leftmins.":".$leftsecs."</td><td>".$call."</td></tr>";
}
$data .="</table>";
