Mail Command Body Issue - Trying to use "do while" loop

Mail Command Body Issue - Trying to use "do while" loop

am 13.09.2009 00:47:40 von cool

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)
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 - dave

----- full email code --------

$mail_body = "test \n\n"."test2".do { echo 'test' } while ($row_get1
= mysql_fetch_assoc($get1))."Thanks
test xxx"; ?>

$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.php

Re: Mail Command Body Issue - Trying to use "do while" loop

am 13.09.2009 02:08:10 von cool

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)
> > 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 - dave


I got it working like this....


$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 --------
>
> > $mail_body = "test \n\n"."test2".do { echo 'test' } while
> ($row_get1 = mysql_fetch_assoc($get1))."Thanks
> test xxx"; ?>
>
> > $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.php
>



Thanks,
cool@hosting4days.com






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