$sql = "SELECT email FROM users WHERE username='$User'";
$result = $conn->query($sql);
if($result->num_rows > 0){
while($row = $result->fetch_assoc()){
$email = $row["email"];
}
}
echo $email;
require_once("class.phpmailer.php");;
$email = new PHPMailer();
$email->From = "clientinformation@apbdispatch.com";
$email->Subject = "$from";
$email->AddAddress("$email");
当回显$ email时,它会返回人员电子邮件地址。但是,当把它放在双引号中时,我收到一条错误消息,指出无法将对象转换为字符串。
感谢您的帮助,
aimmmmmmmmm
答案 0 :(得分:2)
发现问题:
检索电子邮件:
$email = $row["email"];
实例化你的邮件:
$email = new PHPMailer();
^---oops, now your database result is destroyed.