John Michael Ayeras Rivera John Michael Ayeras Rivera - 4 months ago 9
PHP Question

PHP Sending array records in email

Hi can someone help me about sending a email with the array data I gathered?
I'm trying to fetch records on the DB using array and then I'll email it

Here's my code:
I will get the records I want first:

$queclient_credit = "SELECT company, credits FROM clients WHERE credits <= 20 and company !='' ORDER BY credits ASC ";
$getque = mssql_query($queclient_credit) or die();
while ($rowclient_credit=arrayfetch($getque)){
$rowcompany = $rowclient_credit['company'];
$rowcredits = $rowclient_credit['credits'];
Then put it on array:
$data = array(

$dat = implode(' : ', $data);
if($rowcredits<= 20){
$to = '';

$gmailPass = 'password';
$mail = new PHPMailer();

$mail->SMTPAuth = true;

$mail->SMTPSecure = "ssl";

$mail->Host = '';

$mail->Port = '465';

$mail->Username = $from;

$mail->Password = $gmailPass;
$mail->From = $from;
$mail->FromName = $from;
$mail->AddReplyTo($from, $from);
$mail->Subject = 'Credit System ';
$mail->Body = $message;
$mail->MsgHTML('<b><p>'.$dat.' credits<p><b>');
$mail->AddAddress($to, $to);
// $mail->ErrorInfo;
echo 'Message Successfully Sent!';

Thank you for who will answer


If you want display all the details through table in mail use like this,


  while ($rowclient_credit=arrayfetch($getque)){
            $rowcompany = $rowclient_credit['company'];
            $rowcredits = $rowclient_credit['credits'];
            $data.="<tr> <td>".$rowcompany."</td>