我正在尝试为网络表单设置电子邮件通知:
$query = "UPDATE email_tbl SET notified='".mysqli_real_escape_string($conn,$notified)."', reasoning='".mysqli_real_escape_string($conn,$reasoning)."' WHERE id='$id'";
$result=mysqli_query($conn, $query);
$query2 = "SELECT `or_user` FROM `usf_tbl` WHERE `id` = $id";
$result = mysqli_query($conn,$query2);
while ($row= mysqli_fetch_assoc($result))
$to = "example@email.com, $row[or_user]";
$subject = "Email Notification";
$message = "
<html>
<p>Email Notification for $row[or_user]</p>
</html>";
我按要求收到了电子邮件,但电子邮件不包含“or_user”。但是,电子邮件会根据需要发送给“or_user”。 为什么它不在实际电子邮件中打印“or_user”? 提前致谢。
最佳答案
$query = "UPDATE email_tbl SET notified='".mysqli_real_escape_string($conn,$notified)."', reasoning='".mysqli_real_escape_string($conn,$reasoning)."' WHERE id='$id'";
$result=mysqli_query($conn, $query);
$query2 = "SELECT `or_user` FROM `usf_tbl` WHERE `id` = $id";
$result = mysqli_query($conn,$query2);
while ($row= mysqli_fetch_array($result))
{
$to = "example@email.com, $row['or_user']";
$subject = "Email Notification";
$message = "
<html>
<p>Email Notification for". $row['or_user']."</p>
</html>";
}
关于PHP - 无法回显 $row,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43656470/