PHP echo results from a table

I have this PHP Code:

while($contacts2=mysql_fetch_array($rs))
    {
        //generate the list of emails address in an array
        $emails_list[] = $contacts2["email"];
    }

so it puts all my results into an array but when i echo $emails_list
outside of the while loop it just displays Array

how can i make it display like:

result1,result2,result3
etc

Here is your answer

while($contacts2=mysql_fetch_array($rs))
{
     //generate the list of emails address in an array
     $emails_list[] = $contacts2["email"];
}

$emails_list = implode(',', $emails_list);
echo "(". $emails_list . ")";

I think you should try like this,

$mail->AddAddress('[email protected]', 'Person One');
$mail->AddAddress('[email protected]', 'Person Two');

With PHPMailer
, you can do as,

while($contacts2=mysql_fetch_array($rs))
{
    $mail->AddAddress($contacts2['emails'], $contacts2['name']);
}
Hello, buddy!稿源:Hello, buddy! (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 综合编程 » PHP echo results from a table

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录