I am trying to send the contents of an array through mail, I have tried the print_r method however do not really like the way it is formatted in the email, so I tried the implode, however currently it is not actually sending the content, rather just "Array Array Array"
This is my code:
<?php
$con = mysqli_connect("localhost", "user","pw", "db");
if (!$con)
{
die('Could not connect: ' . mysqli_error($con));
}
$recipient_email = "[email protected]";
$result= mysqli_query($con, "SELECT * FROM subscribers WHERE datetime_registered >= DATE_SUB(NOW(), INTERVAL 9 DAY)")or die(mysqli_error($con));
$subscribers = array();
while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){
$subscribers[] = array(
"uid" => $row['id'],
"name" => $row['name'],
"email" => $row['email'],
"ip" => $row['ip'],
"date_registered" => $row['datetime_registered']
);
}
$headers = 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
$headers .= 'From: '.$recipient_email.''."\n";
$subject = "Subject";
$recipient = $recipient_email;
$content = implode("\n", $subscribers);
mail($recipient, $subject, $content, $headers);
?>
Does anyone know what is going wrong?