Hello, everyone.
I have a small problem and I can not seem to get out of it. The problem is this:
I need to generate a pdf (report) with some data coming from a mysql query. So far so good! But all this code that will appear in the pdf is being generated via PHP script mixed with HTML. In the middle of this code, I call a function and need to display the result of it inside an HTML snippet, here is the problem, I can not hit the correct syntax of the foreach loop that is inside that HTML. Here is the snippet of code:
$montagem = "<!DOCTYPE html>
<html lang='pt-br'>
<head>
<meta charset='utf-8'>
</head>
<body>
<h1 style='font-size: 12px; text-align: center;'>ATESTADO ZOOSSANITÁRIO PARA
CAPRINOS</h1>
<table style='width: 100%; margin: 0 20px;'>
<h1 style='font-size: 13px; text-align: center;'>IDENTIFICAÇÃO DOS ANIMAIS</h1>
<table cellspacing='0px' cellspadding='0px' style='width: 100%; margin: 0 20px;'>
<tr style='text-align: center; vertical-align: middle;'>
<td rowspan='2' style='border: 1px solid #000; border-right: 0 none; padding: 0;'>Ordem</td>
<td rowspan='2' style='border: 1px solid #000; border-right: 0 none;'>Espécie</td>
<td rowspan='2' style='border: 1px solid #000; border-right: 0 none;'>Raça</td>
<td colspan='2' style='border: 1px solid #000; border-right: 0 none; border-bottom: 0 none;'>Nº por Sexo</td>
<td rowspan='2' style='border: 1px solid #000;'>Total</td>
</tr>
<tr style='text-align: center;'>
<td style='border: 1px solid #000; border-right: 0 none;'>Macho</td>
<td style='border: 1px solid #000; border-right: 0 none;'>Fêmea</td>
</tr>
foreach ($caprinos2 as $caprino) {
<tr class='text-center'>
<td>echo $caprinos2[capregistro]</td>
<td>$caprinos2[especie]</td>
<td>$caprinos2[raca]</td>
<td>$caprinos2[qtdmacho]</td>
<td>$caprinos2[qtdfemea]</td>
<td>$caprinos2[municipio]</td>
</tr>
}
</table>
</body>
</html>";
Would anyone have an idea how to display the foreach loop result?