$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 时,它会返回此人的电子邮件地址。但是,当将其放在双引号中时,我收到一条错误消息,指出对象无法转换为字符串。
感谢您的帮助,
目标mmmmmmmm
最佳答案
发现问题:
检索电子邮件:
$email = $row["email"];
实例化您的邮件程序:
$email = new PHPMailer();
^---oops, now your database result is destroyed.
关于php - Sql 查询返回对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39107439/