我的网站上有提醒邮件功能。我从我的sql数据库获得了电子邮件地址,它工作得很好。但我也有一个项目没有。从我必须放入邮件的数据库告诉用户哪些项目已过期并需要返回。我在$ message中有邮件文本。但我不知道如何获得该项目。来自消息内的数据库的变量。我一直在寻找示例和教程,但没有任何作用。这是我到目前为止所得到的。你们中的任何人都有一些建议吗?
if($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$message = "Dear user \n\n Please return item no. $row['Item_no'] as soon as possible. \n\n Regards Thomas";
//echo ($message);
mail ( $row['Email'], "Reminder", $message );
答案 0 :(得分:0)
您只需要在回声中concatenate $row['Item_no']
。
$message = "Dear user \n\n Please return item no. " . $row['Item_no'] . " as soon as possible. \n\n Regards Thomas";