Re: Problem with while loop
| From: | Brad Pauly | Date: | Thu, 08 Jan 2004 05:01:19 +0000 |
| Subject: | Re: Problem with while loop | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-174030@lists.php.net to get a copy of this message | ||
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";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$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; }