title: Displaying a user profile page PHP
body: <p>I'm currently in the process of making a social network. I'm am displaying all registered users with the following code. 
  Is there a better way of doing this?</p>
  
  <pre><code>&lt;?php 
  $query = $db-&gt;query("SELECT * from members");
  
  while($r = $query-&gt;fetch()) {
      echo '&lt;div class="col-sm-6 col-md-6 col-lg-3 membersGrid"&gt;';
      echo '&lt;div class="profileThumb"&gt;';
      echo  '&lt;img width="130" height="130" src="'.$r['profile_pic'].'"/&gt;&lt;br&gt;';
      echo $r['username'], '&lt;br&gt;';
      echo  $r['country'], '&lt;br&gt;';
      echo '&lt;a class="viewProfile" href="profile.php"&gt;&lt;button&gt;View Profile&lt;/button&gt;&lt;/a&gt;';
      echo '&lt;/div&gt;';
      echo '&lt;/div&gt;';
  
  }
    ?&gt;
  </code></pre>
  
  <p>I'm trying to create a link to the individual profile pages for each users. Currently each link is within the above while loop, however, I'm a little uncertain of how to link to the relevant profile page. I'm guessing I have to append a variable to the URL.  Any guidance would be greatly appreciated.</p>
  
  <pre><code>    echo '&lt;a class="viewProfile" href="profile.php"&gt;&lt;button&gt;View Profile&lt;/button&gt;&lt;/a&gt;';
  </code></pre>