Witam
Chciałbym pobrać dane z tabeli mysql i wyłać je mailem przy pomocy PHPmailer.
<?php
$sql = "SELECT * FROM `tabela` WHERE `id` LIKE '".$id."'";
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "localhost";
$mail->SMTPAuth = true;
$mail->Username = "user";
$mail->Password = "passw";
$mail->From = "mail@pl.pl";
$mail->AddAddress("mail@pl.pl");
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = 'temat';
$mail->Body = '<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-2">
</head>
<body>
<table>
//tu chciałbym wstawić wynik poniższego kodu:
</table>
</body>
</html>';
$mail->Send();
?>
kod:
<?php
{
print '<tr><td>'.$wiersz[0].'</td><td>'.$wiersz[1].'</td><td>'.$wiersz[2].'</td></tr>'; }
?>
Nie wiem jak to zrobić. Sprawę utrudnia fakt ,że za każdym razem mogę mieć inną liczbę wierszy.