title: MySQL / PHP - How to match an author id to a user id and display username
body: <p>another question. I need to display a username and so what I'm doing is getting the author id (which is '1'), and then using a query saying get the username from the users table where the author id is the same as the user id.</p>
  
  <p>My problem is that I'm getting the value of '1' returned as I've said above and the following is my code. Am I missing something here or...?</p>
  
  <pre><code> $users = mysqli_query($sql, "SELECT * FROM users WHERE userid = '$authorid'") or die($users . "&lt;br/&gt;" . mysqli_error($sql));
  
   while($userData = mysqli_fetch_array($users)) {
      $postAuthor = $usersData['username'];
  } 
  </code></pre>
  
  <p><strong>Edit 1</strong></p>
  
  <p>I said also mention the above information should show the name 'Dan'.</p>
  
  <p>The user 'Dan' has a user id of 1 should the author id should be 1 (which it is) from the post row. This is the only use of anything to do with the user table so it's not being overridden anywhere. I'm so confused.</p>