即时尝试生成一个电子邮件,以包括一些排序的数据在正文中。 我的电子邮件发送但没有正文中的数据。通过函数也是while循环,如果有意义的话,它们会生成回显的html内容? 这里是其中的一个功能。在字符串中的while循环中运行一个函数?
function ye($coid){
$yest = date("Y-m-d", time() - 86400);
$inouty= mysql_query("SELECT clockings.id AS cid,clockings.uid, clockings.con, clockings.coff, staff.sname ,staff.id, staff.act, staff.coid FROM clockings LEFT JOIN staff ON clockings.uid=staff.id WHERE clockings.dte = '$yest' AND staff.coid =$coid ORDER BY staff.id, clockings.id")or die(mysql_error());
while ($row = mysql_fetch_assoc($inouty)) {
$sname= $row['sname'];
$in= $row['con'];
$out= "- ". $row['coff'];
$id = $row['cid'];
echo"$sname $in $out<br>";}}
,这就是我称之为
$html_text = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>Email</title>
</head>
<body>details Current status for $nicedate as of $now<br>". tod($coid)."<br>Yesterdays Clockings<br>". ye($coid)."</body>
</html>";
没有,如果我改变函数返回一个值,而不是呼应的,我得到的结果,而不是完整循环的只是第一行,但就是包括在电子邮件正文文本中,并且当我在脚本结尾处使用echo函数调用函数时,我会得到所需的输出。 有什么办法可以让这个工作?在此先感谢尼克
你试过一个“沙箱”来回显$ inouty?还单独$ inouty并从那里工作... – Pogrindis