You must learn to escape the quotes and include array elements or objects in the strings, for example:
// Escapar comillas
echo "<img src=\"nombre_de_imagen\">";
// Agregar elementos de array u objetos entre llaves
echo "<img src=\"{$array['indice']}\">";
Then, your example would look like this:
$dir ="assets/img/";
while ($columna = mysqli_fetch_array( $resultado )) {
echo "<article class=\"124\">";
echo "<a href=\"\">";
echo "<img src=\"$dir{$columna['foto']}\" alt=\"\">";
echo "</a>";
echo "</article> ";
}
I find it more convenient to use the HEREDOC structure, where it is not necessary to escape quotes, but to enclose array elements or objects between braces:
$dir ="assets/img/";
while ($columna = mysqli_fetch_array( $resultado )) {
echo <<<EOT // Tres "menor que" seguidos de un identificador
<article class="124">
<a href="">
<img src="$dir{$columna['foto']}" alt="">
</a>
</article>
EOT; // Esta instrucción debe quedar en la primera columna
// Y es el mismo identificador, seguido de un punto y coma
}
Choose the form that best suits you to code, but be sure to escape the quotes when necessary and enclose things like $ row ['column'] or $ db- & gt ; row ('column') .