1

嗨,我有新问题 :) 我正在用面板构建简单的时事通讯,以向注册用户和时事通讯邮件地址发送邮件。

我有这个代码,但时事通讯只发给注册用户。有人能告诉我为什么吗?

    $zapytanie = mysql_query("SELECT login, imie, email FROM uzytkownicy UNION SELECT email,imie,login FROM newsletter");


    while($wynik=mysql_fetch_array ($zapytanie)) {


        $login2 = $wynik['login'];

        $imie = $wynik['imie'];

        $serwis_url = $zmienne['serwis_url'];

        $email = $wynik['email'];



        $tresc = '<!DOCTYPE HTML PUBLIC "-//W3C//Dtd HTML 4.0 transitional//EN">

<html><head><meta http-equiv="Content-type" content="text/html; charset=utf-8"></head>

<body bgcolor="#ffffff"><font face="Arial" style="font-size:13px;" color="#3E3E3E">'.nl2br(($wiadomosc)).'</font></BODY></HTML>';


      $headers = 'Reply-To: '.$zmienne['admin_email'].' <'.$zmienne['admin_email']."> \r\n"; 
        $headers .= 'From: "Administrator" <'.$zmienne['admin_email'].">\r\n"; 
        $headers .= "MIME-Version: 1.0 \r\n"; 
        $headers .= "Content-type: text/html; charset=utf-8 \r\n"; 

        $headers = 'Reply-To: '.$zmienne['admin_email'].' <'.$zmienne['admin_email']."> \r\n"; 
        $headers .= 'From: "Administrator" <'.$zmienne['admin_email'].">\r\n"; 
        $headers .= "MIME-Version: 1.0 \r\n"; 
        $headers .= "Content-type: text/html; charset=utf-8 \r\n"; 
      $headers = iconv("UTF-8","ISO-8859-2", $headers);


        $tresc = strtr($tresc, "\xA5\x8C\x8F\xB9\x9C\x9F", "\xA1\xA6\xAC\xB1\xB6\xBC");

        $tresc = str_replace("{login}",$login2,$tresc);

        $tresc = str_replace("{imie}",$imie,$tresc);

        $tresc = str_replace("{serwis_url}",$serwis_url,$tresc);

        $temat = str_replace("{login}",$login2,$temat);

        $temat = str_replace("{imie}",$imie,$temat);

        $temat = str_replace("{serwis_url}",$serwis_url,$temat);



        mail($email, $temat, $tresc, $headers);


    }


}
4

1 回答 1

0

您必须在联合选择中具有相同的列顺序:

$zapytanie = mysql_query("SELECT login, imie, email FROM uzytkownicy UNION SELECT login, imie, email FROM newsletter");
于 2013-10-25T09:03:19.397 回答