title: Looping results to insert new div with complexities
body: <p>How can I loop results to insert new div with complexities for each result?</p>
  
  <p>I have the following database table with following columns:</p>
  
  <pre><code>ID | UserID | Title | Introduction | Content | Images | Background | Date | Pinned
  </code></pre>
  
  <p>I have the following PHP code:</p>
  
  <pre><code>if($latest = $con-&gt;query("SELECT * FROM Posts WHERE Pinned='0' LIMIT 4")) {
      if($latest-&gt;num_rows &gt; 0) {
                                              //&lt;-- result loop here 
      } else {
          echo '&lt;h1 class="alert fade"&gt;No Posts&lt;/h1&gt;';
      }
  
      $latest-&gt;close();
  };
  </code></pre>
  
  <p>I would like to format the output as follows:</p>
  
  <pre><code>&lt;div class="post standard" style="background-image:url([1]);"&gt;
      &lt;a href="view.php?id=[2]"&gt;
          &lt;div class="shader"&gt;&lt;/div&gt;
              &lt;div class="info"&gt;
                  &lt;h1&gt;[3]&lt;/h1&gt;
                  &lt;p&gt;[4] - [5]&lt;/p&gt;
              &lt;/div&gt;
  &lt;/div&gt;
  
  [1] - Background
  [2] - ID
  [3] - Title
  [4] - UserID
  [5] - Date
  </code></pre>
  
  <p>How would I accomplish this?</p>