0

我有这样的错误

警告:mysql_fetch_array() 期望参数 1 是资源,在第 543 行的 /home/sibisier/public_html/customer/input_customer_issue.php 中给出的字符串

这是第 543 行的代码

$query_email = "SELECT employee.nip, employee.nama, employee.job_title,
                                    employee.unit_id, employee.business_email, unit.nama_unit
                                    FROM employee
                                    INNER JOIN unit ON employee.unit_id = unit.unit_id
                                    where employee.job_title IN('Team Leader','Assistant Relationship Manager','PROFESSIONAL STAFF')
                                    AND employee.unit_id IN(12)";

                    $resul1 = mysql_query($query_email) or die(mysql_error());{
                        $to = $resul1['business_email'];
                        $subject = 'Notifikasi';

                        $message = "<table>";
                        $message .= "<tr><td>Date</td><td>:</td><td>" . $tanggal_sekarang . "</td></tr>";
                        $message .= "<tr><td>NIP</td><td>:</td><td>" . $nip . "</td></tr>";
                        $message .= "<tr><td>Unit</td><td>:</td><td>" . $resul1['nama_unit'] . "</td></tr>";
                        $message .= "<tr><td>CIF</td><td>:</td><td>" . $cif . "</td></tr>";
                        $message .= "<tr><td>Comment</td><td>:</td><td>" . $comment . "</td></tr>";
                        $message .= "</table>";
                        $headers = "From: admin@sibisiser.com \n";
                        $from .= "Reply-To: zack.zacky14@gmail.com \n";
                        $from .= "Content-type: text/html \r\n";
                        mail($to, $subject, $message,$headers, $from);
                        echo "Mail Sent.";

我不知道,我一直在搜索并且总是得到这个错误。

我需要帮助。谢谢

4

1 回答 1

1

下载 PHPMailer 包: http: //phpmailer.worxware.com/

并尝试此代码->

<?php
require_once('PHPMailer/class.phpmailer.php');

$query_email = "SELECT employee.nip, employee.nama, employee.job_title,
                                    employee.unit_id, employee.business_email, unit.nama_unit
                                    FROM employee
                                    INNER JOIN unit ON employee.unit_id = unit.unit_id
                                    where employee.job_title IN('Team Leader','Assistant Relationship Manager','PROFESSIONAL STAFF')
                                    AND employee.unit_id IN(12)";

                        $resul1 = mysql_query($query_email) or die(mysql_error());

                        $row=mysql_fetch_array($resul1, MYSQL_ASSOC);
                        if($row)   {
                        $to = $row['business_email'];
                        $htmlbody =  '<table>
                        <tr><td>Date</td><td>:</td><td> '. $tanggal_sekarang .' </td></tr>
                        <tr><td>NIP</td><td>:</td><td> '. $nip .' </td></tr>;
                        <tr><td>Unit</td><td>:</td><td> '. $resul1['nama_unit'] .' </td></tr>;
                        <tr><td>CIF</td><td>:</td><td> '. $cif .' </td></tr>;
                        <tr><td>Comment</td><td>:</td><td> '. $comment .' </td></tr>;
                        </table>';

                        $mail = new PHPMailer();
                        $mail->From      = 'admin@sibisiser.com';
                        $mail->FromName  = 'yourName';
                        $mail->Subject   = 'Notifikasi';
                        $mail->Body      = $htmlbody;
                        $mail->AddAddress($to);
                        $mail->Send();



    }

?>
于 2013-09-25T16:37:50.100 回答