title: How to add html in foreach loop?
body: <p>Basically what I need to do foreach three divs and show 5 services from the database.</p>
  
  <p>I don't know how to do that. Can someone explain to me how? 
  I try everything but just I have no idea how to do it.
  Second div should not be in row.
  Output be like on image link that I put below.</p>
  
  <p>Thanks in advance.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;title&gt;Bootstrap Example&lt;/title&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
      &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;div class="container"&gt;
  
      &lt;div class="row"&gt;
          &lt;div class="col-lg-12"&gt;
              &lt;div class="row"&gt;
  
                 &lt;div class="col-lg-4"&gt;
                      &lt;div class="row"&gt;
                          &lt;div class="service-img service" style="background-image: url(images/image1.jpg); height: 300px; background-color: red;"&gt;
                              &lt;figcaption&gt;
                                  &lt;h3&gt;Service Title Goes Here 1&lt;/h3&gt;
                              &lt;/figcaption&gt;
                              &lt;a href="/detail.php"&gt;&lt;/a&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="row"&gt;
                          &lt;div class="service-img service" style="background-image: url(images/image2.jpg); height: 300px; background-color: green;"&gt;
                              &lt;figcaption&gt;
                                  &lt;h3&gt;Service Title Goes Here 2&lt;/h3&gt;
                              &lt;/figcaption&gt;
                              &lt;a href="/detail.php"&gt;&lt;/a&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
  
                  &lt;div class="col-lg-4 service-middle"&gt;
                      &lt;div class="service-img service" style="background-image: url(images/image3.jpg); height: 600px; background-color: blue;"&gt;
                          &lt;figcaption&gt;
                              &lt;h3&gt;Service Title Goes Here 3&lt;/h3&gt;
                          &lt;/figcaption&gt;
                          &lt;a href="/detail.php"&gt;&lt;/a&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
  
                  &lt;div class="col-lg-4"&gt;
                      &lt;div class="row"&gt;
                          &lt;div class="service-img service" style="background-image: url(images/image4.jpg); height: 300px; background-color: yellow;"&gt;
                              &lt;figcaption&gt;
                                  &lt;h3&gt;Service Title Goes Here 4&lt;/h3&gt;
                              &lt;/figcaption&gt;
                              &lt;a href="/detail.php"&gt;&lt;/a&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="row"&gt;
                          &lt;div class="service-img service" style="background-image: url(images/image5.jpg); height: 300px; background-color: pink;"&gt;
                              &lt;figcaption&gt;
                                  &lt;h3&gt;Service Title Goes Here 5&lt;/h3&gt;
                              &lt;/figcaption&gt;
                              &lt;a href="/detail.php"&gt;&lt;/a&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
  
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
  &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/jxQAg.png" rel="nofollow noreferrer">This should look like this</a></p>