我正在为此苦苦挣扎,但无法弄清楚...我正在使用 mamp 堆栈,我正在尝试向多个收件人发送 php 电子邮件,并且在获取与电子邮件一起发送的数据库信息时遇到问题。在我的 php 中,我建立连接,从数据库中提取值,然后尝试将变量设置为等于我的数据库值。之后,我关闭连接,然后进入邮件信息……我收到的所有邮件都是字母“t”。有什么想法可以让我正确输出吗?
<?php
include("connect.php");
?><!--database connection-->
<?php //2. Perform db query
//specify the number of days to review
$days = 6 * 24;
$query = "SELECT d.memo ";
$query .= "FROM employee AS e, digital_memo AS d ";
$query .= "WHERE e.employee_id = d.employee_id AND ";
$query .= "d.time > DATE_SUB(NOW(), INTERVAL " . $days . " HOUR)";
$result = mysqli_query($connection, $query);
$data = mysqli_fetch_assoc($result);
$paragraph_markers = array("\n\n","\n");
$data = str_replace($paragraph_markers,'</p><p>',$data["memo"]);
?><!--query the database-->
<?php
include("close.php");
?>
<?php
$to = "barlowmitch@hotmail.com";
$subject = "Test mail";
$message = $data["memo"];
$from = "barlowmitch@hotmail.com";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
有什么想法可以在这里连接这些点吗?谢谢你的帮助!