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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Sep 12, 2009, at 3:47 PM, cool@xxxxxxxxxxxxxxxx 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 - dave


I 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@xxxxxxxx"; //senders e-mail adress
$recipientname = "test@xxxxxxxx";
$recipient = "test@xxxxxxxx"; //recipient
$subject = "test".
$header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields
$fullto = $recipientname . " <" . $recipient . ">";
//$fullto = $recipientname . " <" . $recipient . ">".", ".$recip2;
ini_set('sendmail_from', 'test@xxxxxxxx');

mail($fullto, $subject, $mail_body, $header); //mail command :)
?>



Thanks,
cool@xxxxxxxxxxxxxxxx






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




Thanks,
cool@xxxxxxxxxxxxxxxx






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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux