Loop row in bootstrap every 3 columns
<p>I want every row in my page to display 3 thumbnails, but its stacked in one row. </p>

<p>How do I manage the looping? Thank you...</p>

<pre><code>&lt;?php
    foreach ($rows as $row){
?&gt;  
        &lt;div class="col-md-3"&gt;
            &lt;div class="thumbnail"&gt;
                &lt;img src="user_file/&lt;?php echo $row-&gt;foto; ?&gt;"&gt;
            &lt;/div&gt;
        &lt;/div&gt;

&lt;?php
}
?&gt;
</code></pre>

<p>This code generates stacked thumbnails in a row. How can I generate the row for every 3 columns?</p>

<p>This screenshot is what I got from the code:</p>

<p><a href="https://i.stack.imgur.com/Eb9GH.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/Eb9GH.jpg" alt="Thisis What i got"></a></p>

<p>This is what I'm looking to get:</p>

<p><a href="https://i.stack.imgur.com/pVagW.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/pVagW.jpg" alt="This is what i want. "></a></p>