title: how to mysqli inner join with 3 tables
body: <p>In the end I need results to contain all data from all 3 tables. How to join the 3 tables so all is present in the end. Here is what I have so far:</p>
  
  <pre><code>if ($results = $db-&gt;query("SELECT * FROM HWData
                          LEFT JOIN ClassData
                          ON HWData.class = ClassData.class
                          LEFT JOIN Judges
                          ON Judges.groupnum = ClassData.groupnum
                          ORDER BY HWData.entrynum",
                          MYSQLI_USE_RESULT)) {
  $result_set = mysqli_fetch_all($results, MYSQLI_ASSOC);
  echo json_encode($result_set);
  </code></pre>
  
  <p>The results are not as expected. It's odd that <code>console.log[i]['groupnum'];</code> shows correct groupnum but <code>$("#output").append("&lt;p&gt;"+data[i]['groupnum']);</code> shows only 1's</p>
  
  <p>3 tables as follows:</p>
  
  <p><strong>ClassData</strong></p>
  
  <pre><code>groupnum    abbr
  0   DQB
  0   DQC
  1   SUM
  1   PP
  1   FOS
  1   VANF
  1   VANS
  2   AFCF
  2   AFCS
  2   ICCS
  2   CCS
  3   LSUF
  3   LTMS
  4   HL
  4   MC
  </code></pre>
  
  <p><strong>Judges</strong></p>
  
  <pre><code>judge   group
  Coleen  4
  Daniel  3
  Aaron   2
  Jeff    1
  </code></pre>
  
  <p><strong>HWData</strong></p>
  
  <pre><code>entrynum    fname   class
  1   Esteban FOS
  2   Dalia   PP
  3   Sheri
  4   Sheri   HL
  5   Sheri   MC
  10  Danita  ICCS
  11  Chris   AFCS
  </code></pre>