Re: Mail Command Body Issue - Trying to use 'do while' loop
| From: | cool@hosting4days.com | Date: | Sun, 13 Sep 2009 00:08:10 +0000 |
| Subject: | Re: Mail Command Body Issue - Trying to use 'do while' loop | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-297960@lists.php.net to get a copy of this message | ||
On Sep 12, 2009, at 3:47 PM, cool@hosting4days.com wrote:
I'm having a problem with mail body issue trying to use 'do while' loop in the $mail_body var. this line: do { echo $row_get1['name'] } while ($row_get1 = mysql_fetch_assoc($get1)) will show ok when it's on the page elsewhere (not in the $mail_body var) but typed like: --- ok on web page (not email) <?php do { echo $row_get1['vt_name']; } while ($row_get1 = mysql_fetch_assoc($get1)); ?> Q: i want "TEXT" LOOP "TEXT" - AM I MISSING some syntax characters like(; or??) somewhere or ???? THANKS for your help - daveI got it working like this.... <?php $loop1 = ''; do { $loop1 = $loop1."\n".$row_get1['vt_name'].' - '; } while ($row_get1 = mysql_fetch_assoc($get1)); $mail_body = "test \n\n"."test2 ".$loop1."Thanks test xxx"; ?> Q: is this the best way?
----- full email code -------- <?php $mail_body = "test \n\n"."test2".do { echo 'test' } while ($row_get1 = mysql_fetch_assoc($get1))."Thanks test xxx"; ?> <?php $Name = "test"; //senders name $email = "test@test.com"; //senders e-mail adress $recipientname = "test@test.com"; $recipient = "test@test.com"; //recipient $subject = "test". $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields $fullto = $recipientname . " <" . $recipient . ">"; //$fullto = $recipientname . " <" . $recipient . ">".", ".$recip2; ini_set('sendmail_from', 'test@test.com'); mail($fullto, $subject, $mail_body, $header); //mail command :) ?> Thanks, cool@hosting4days.com --PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpThanks, cool@hosting4days.com