On Jan 7, 2004, at 10:02 PM, Richard Kurth wrote:


 I can't seam to get this while loop to work properly. It should
 create a message that has the first two lines and then it will list
 all the domain that meat the criteria.


$lines = "The following are web sites that are at 95% usage or more of there web space\n";
$lines = "Site Name Used(MB) Free(MB) Allowed(MB) \n";
$result=mysql_query("SELECT * FROM domplans");
while($row = mysql_fetch_array($result)){
$dom=$row["domname"];
$total=$row["quota"];
$result1=mysql_query("SELECT * FROM datasubused where domname = '$dom'");
$proccess = mysql_fetch_array($result1);
$totalused=$proccess["quotaused"];
$totalfree=$total - $totalused;
$percent = ceil(100*$totalused/$total);
If($percent>="95"){
$lines = "$dom $totalused $totalfree $total \n";
for( $i=0;$i<count($lines);$i++) {
$message .=$lines[$i];
}
}
echo $message;
}

You are overwriting $lines every time you make an assignment. From the looks of how you create $message, you want $lines to be an array. Try $lines[] = 'whatever' instead of $lines = 'whatever';


- Brad

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to