I am new to HTML, I am trying to send emails in PHP with a table attachment, the best idea I could come up with was this:
$table = "<html>
<head>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
</style>
</head>
<body>
<table>
<tr>
<th>Account</th>
<th>Credit used</th>
<th>Sent messages</th>
<th>Balance</th>
</tr>
<?php foreach ($statistics as $row) {
<tr>
<td>". $row["username"] ."</td>
<td>". $row["creditUsed"] ."</td>
<td>". $row["sentMessages"] ."</td>
<td>". $row["balance"] ."</td>
</tr>
}
?>
</body>
</html>
</table>";
This worked fine until I added the loop, it is treated like a string and gives the error Notice: Array to string conversion I do not know how to make it work