I have some dynamic html and wants a new line, i.e. <br>
tag after each <img>
tag.
for ($i=1; $i < mysqli_num_rows($result_p); $i++){
$row_p = mysqli_fetch_array($result_p);
echo "<img id='". $i . "' src='". $row_p['url'] ."' width='200' height='200' alt='img'>";
echo "<br>"; // doesn't work
}
I checked the resulting html markup on W3C validation service - there is no error, but <br>
tag still doesn't work.
There are a lot of better solutions in order to have what you want:
Option 1:
Put the images list in an unorderlist putting a display:block attribute to li tags
<ul class="images">
<li>
<img src=""/>
</li>
</ul>
Then in your css stylesheet:
ul.images li{display:block}
Option 2:
Just surround you img
tag with a block element : <div>, <p>
for example and use css for giving it more space between images