title: How to retrieve certain value(s) through foreign key linking in MySQL?
body: <p>sorry for the unclear title but I couldn't come up with anything better.</p>
  
  <p>My dilemma is this:</p>
  
  <p>I have one InnoDB table in my database called "meetings" with the following structure:</p>
  
  <ul>
  <li>meeting_id (primary key, auto_increment)</li>
  <li>user1_id (foreign key pointing to a user_id in a table called "users")</li>
  <li>user2_id (foreign key pointing to a user_id in a table called "users")</li>
  <li>time (type DATETIME)</li>
  <li>location (type VARCHAR(200))</li>
  </ul>
  
  <p>The table "users" is basic and looks like this:</p>
  
  <ul>
  <li>user_id (primary key, auto_increment)</li>
  <li>first_name (type VARCHAR(30))</li>
  <li>last_name (type VARCHAR(30))</li>
  </ul>
  
  <p>I have a PHP file with the aim to simply print out a description of the meeting, e.g.:</p>
  
  <p><em>You saved the following meeting information:</em></p>
  
  <p><em>User 1 | User 2 | Time &amp; Date | Meeting location</em></p>
  
  <p><em>John Doe | Jane Doe | 2010-10-10 10:10:10 | New York</em></p>
  
  <p>Now, I simply want to use the meeting ID, call my database (only the "meetings" table) and be able to get the first_name and last_name of the user1 and user2.</p>
  
  <p>Right now, my non-working code looks like this:</p>
  
  <pre><code>$query = "SELECT * FROM meetings WHERE meeting_id = " . $mid;
  $data  = mysqli_query($dbc, $query);
  $row   = mysqli_fetch_array($data); // ANY CHANGES HERE?
  
  ...
  
  echo '&lt;p&gt;You saved the following meeting information::&lt;/p&gt;';
  echo '&lt;table&gt;';
  echo '&lt;tr&gt;&lt;th&gt;User 1&lt;/th&gt;&lt;th&gt;User 2&lt;/th&gt;&lt;th&gt;Time &amp; Date&lt;/th&gt;&lt;th&gt;Meeting location&lt;/th&gt;&lt;/tr&gt;';
  echo '&lt;td&gt;' . $row['user1_id']['first_name'] . ' ' . $row['user1_id']['last_name'] . '&lt;/td&gt;'; // NON-WORKING
  echo '&lt;td&gt;' . $row['user2_id']['first_name'] . ' ' . $row['user2_id']['last_name'] . '&lt;/td&gt;'; // NON-WORKING
  echo '&lt;td&gt;' . $row['date_time'] . '&lt;/td&gt;';
  echo '&lt;td&gt;' . $row['location'] . '&lt;/td&gt;';       
  echo '&lt;/table&gt;';
  ...
  </code></pre>
  
  <p>(How) can I retrieve the first_name/last_name links without making separate calls to the "users" table? When I check phpMyAdmin, the InnoDB foreign key links seem to work fine. Many thanks in advance!</p>