title: Dynamically populating a div with data from a MySQL table
body: <p>Lets say I have a persons table :</p>
  
  <pre><code>forename    surname    age    gender
  --------------------------------------------
  adam        example    90      male
  john        example    90      male
  </code></pre>
  
  <p>If I wanted to display this information in separate divs, how could this be done? Say for example the following HTML.</p>
  
  <pre><code>&lt;div class = "container"&gt;
       &lt;div class="wrapper"&gt;
          &lt;div class = "jumbotron"&gt;
              &lt;!-- adams data here --&gt;
          &lt;/div&gt;
          &lt;div class = "jumbotron"&gt;
              &lt;!-- johns data here --&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I'm aware on how to query the DB to get the information into PHP variables, I'm just not sure how to dynamically display the data in separate divs.</p>
  
  <p>Below is how I am getting the data</p>
  
  <pre><code>&lt;?php 
  
      if($result = $db-&gt;query("SELECT forename,surname FROM users ")){
          if($count = $result-&gt;num_rows){
              while($row = $result-&gt;fetch_object()){
                  echo $row-&gt;forename, '&lt;br&gt;&lt;br&gt;';
                  echo $row-&gt;surname, '&lt;br&gt;&lt;br&gt;';
              }
              $result-&gt;free();
         }
      }
     ?&gt;
  </code></pre>