title: Getting Username By Id
body: <p>Could someone help me out as i'm new to PHP and MYSQLI</p>
  
  <p>I'm trying to make a comment system for my movies page example below</p>
  
  <p>Database Structure</p>
  
  <p>Comments Table</p>
  
  <pre><code>id          int(11)         No  None    AUTO_INCREMENT  
  movie_id    int(11)         No  None        
  user_id     int(11)         No  None        
  message     varchar(1000)   No  None        
  timestamp   timestamp       No  CURRENT_TIMESTAMP
  </code></pre>
  
  <p>Users Table</p>
  
  <pre><code>id          int(50)         No  None    AUTO_INCREMENT  
  username    varchar(50)     No  None
  email       varchar(100)    No  None        
  group       varchar(20)     No  None        
  password    varchar(20)     No  None
  </code></pre>
  
  <p>PHP CODE</p>
  
  <pre><code>&lt;?php
  $comments = mysqli_query($con,"SELECT * FROM `comments` ORDER BY `timestamp` DESC");
  while($comment = mysqli_fetch_array($comments)) {
  ?&gt;
  
  &lt;a href="www.mysite.com/movie.php?id=&lt;?php echo $comment['movie_id']; ?&gt;"&gt;&lt;?php echo $comment['message']; ?&gt;&lt;/a&gt;
  
  &lt;?php 
  } 
  mysqli_close($con);
  ?&gt;
  </code></pre>
  
  <p>So what i want to do is get <code>username</code> from <code>Users table</code> by using <code>user_id</code> from <code>Comments table</code>  </p>
  
  <p>Could someone show me how to get them and how to echo them please.</p>