I'm sure this is really simple but its driving me nuts!
<p>'.printHistory($result).' </p>
Above is a snippet of code from my html e-mail,and this is the function printHistory
:
function printHistory($result){
$hisNum=0;
foreach ($result as $item){
"<b><u>update Number </u></b>".$hisNum."<br/>";
"<b>Time: </b>". $item['start_time']."<br/>";
"<b>Date: </b>". $item['date']."<br/>";
"<b>Comment: </b>". $item['comment']."<br/>";
$hisNum=$hisNum+1;
}
}
I receive no errors, but the text isn't printed to my e-mail. Any help would be appreciated!
you forget to return
the string, so no output is produced.
function printHistory($result){
$hisNum=0;
$string = "";
foreach ($result as $item){
$string .= "<b><u>update Number </u></b>".$hisNum."<br/>";
$string .= "<b>Time: </b>". $item['start_time']."<br/>";
$string .= "<b>Date: </b>". $item['date']."<br/>";
$string .= "<b>Comment: </b>". $item['comment']."<br/>";
$hisNum=$hisNum+1;
}
return $string;
}
You need to echo out the result:
function printHistory($result){
$hisNum=0;
foreach ($result as $item){
echo "<b><u>update Number </u></b>".$hisNum."<br/>"
. "<b>Time: </b>". $item['start_time']."<br/>"
. "<b>Date: </b>". $item['date']."<br/>"
. "<b>Comment: </b>". $item['comment']."<br/>";
$hisNum=$hisNum+1;
}
}