I'm trying to migrate the files with the MySQL Functions to the PDO. But I can not loop the images with the code below.
<?php
$sql = $pdo->prepare("SELECT * FROM banner");
$sql->execute();
foreach($sql->fetchAll() as $res){
$tabela = '<tr>
<td align="center"><img width="100" height="auto" src="../img_banner/'.$res['imagem'].'" title=""/></td>
<td align="center">'.$res['texto'].'</td>
<td align="center">'.$res['fonte'].'</td>
<td align="center">'.$res['tam_fonte'].'</td>
<td align="center"><div style="background-color:'.$res['cor_texto'].'; width:50%; height:20px;"></div></td>
<td align="left">
<a style="text-decoration:none;" href="edit_banner_inicial-upd.php?codigo='.$res['codigo'].'">
<img width="25" src="../img/edit.png" title="Editar Banner '.$res['codigo'].'"/>
</a>
<a style="text-decoration:none;" href="inicial_del_banner.php?codigo='.$res['codigo'].'">
<img width="25" src="../img/del.png" title="Excluir Banner '.$res['codigo'].'"/>
</a>
</td>
</tr>';
}
?>
So it shows me only the last file registered in the Banner table. But when I include a period before the equals sign in the 4th line of the code, as shown below
$tabela .= '<tr>
It brings me all the files registered in the Banner table, however it shows me this message below.
Referring to line 42 which in the case is the 20th of the code published here, as shown below.
</tr>';
If friends can help me solve this problem, I'll be very grateful.