title: How to fetch and echo the results of a JOIN in PHP
body: <p>A re-post of a question posted here a <a href="https://stackoverflow.com/questions/49502466/do-i-need-a-left-natural-or-simple-join-in-sql">few weeks ago</a>, that I'm still struggling with. </p>
  
  <p>So all I want to do is display the username of the person who has created an assignment to be displayed on pages like this: <a href="https://vloggi.com/commission/21" rel="nofollow noreferrer">https://vloggi.com/commission/21</a></p>
  
  <p>At present in the controller page I have the following queries: </p>
  
  <pre><code>$sql = "SELECT * FROM users_gor WHERE usrg_usr_id = ".$db-&gt;quote($user_info['usr_id'])." LIMIT 1";
  $rows = $db-&gt;select($sql);
  $users_gor = $rows[0];
  
  $sql = "SELECT * FROM users_vgr WHERE usrv_usr_id = ".$db-&gt;quote($user_info['usr_id'])." LIMIT 1";
  $rows = $db-&gt;select($sql);
  $users_vgr = $rows[0];
  
  $sql = "SELECT * FROM users WHERE usr_id = ".$db-&gt;quote($user_info['usr_id'])." LIMIT 1";
  $rows = $db-&gt;select($sql);
  $users = $rows[0];
  
  $sql = "SELECT * FROM vlog-ops WHERE vlop_usr_id ".$db-&gt;quote($user_info['usr_id'])." LIMIT 1";
  $rows = $db-&gt;select($sql);
  $users = $rows[0];
  
  $sql = "SELECT usr_name AS vlop_usr_name FROM users WHERE usr_id = ".$db-&gt;quote($user_info['usr_id'])." LIMIT 1";
  $result = mysql_query($sql);        
  $row = mysql_fetch_array($result);
  
  
  $sql = "SELECT usr_name  FROM users WHERE usr_id='".$db-&gt;quote($user_info['usr_id'])." LIMIT 1";
  $creator = $db-&gt;select1($sql);
  $users = $rows[0];
  
  $query = "SELECT u.usr_name, g.usrg_orgname, v.vlop_usr_id  FROM users u 
  JOIN vlog-ops v on u.usr_id = v.vlop_usr_id 
  JOIN users_gor g on u.usr_id = g.usrg_usr_id";
  </code></pre>
  
  <p>And then in the template page, I have the following fetch and echo. </p>
  
  <pre><code>             &lt;?php
               $result = mysqli_query($connection, $query);
               while($row = mysqli_fetch_assoc($result)) {
                   echo 'User name = ' . $row['u.usr_name'];
                   echo 'Org name = ' . $row['g.usrg_orgname'];
                   echo 'Job posting user id = ' . $row['v.vlop_usr_id'];
               }
               ?&gt;   
  </code></pre>
  
  <p>But it doesn't work. I tried Paulo Hgo's code and it doesn't work either.</p>
  
  <p>So I understand the basic concept of JOIN, but need some help actually echoing or printing the variable. </p>
  
  <p>Sorry for re-posting. </p>