title: Multiple While Loops within a While Loop?
body: <p>Total newbie trying to learn... thanks for all the help so far!</p>
  
  <p>UPDATE - updated code below - Thanks Phill</p>
  
  <p>I'm now trying to get the relevant horse information from a table <code>horses</code> which I can join to <code>race_form</code> with the horse_name field.  I want to then display the information for each horse in the race below the while($racecard) info.  Does this make it a bit clearer?</p>
  
  <p>I thought I could just do another query and then a while loop with mysql_fetch_array below the one I have already and that would display it and then move onto the next race, but that apparently doesn't work...?!</p>
  
  <p>I'm wondering if you can run 2 while loops after each other inside a while loop?  I am working on a horse racing formguide - I can display each race list, but underneath I want to display individual horse details on each horse in the race.  Anyway if you look at this page you can see what I'm trying to do: </p>
  
  <p><a href="http://tasmanianracing.com/superform/formguide.php?meetingID=21042011LAUN&amp;Submit=View+Form" rel="nofollow">http://tasmanianracing.com/superform/formguide.php?meetingID=21042011LAUN&amp;Submit=View+Form</a></p>
  
  <p>Problem is, any time I put a second while loop after the race list, it won't show up.  I'm trying to run a query to get the horse details from my horse table and then run a while for each horse in the race, but nothing shows up.</p>
  
  <p>I hope this is clear enough ... my snippet of code is below - please let me know if I've missed out something important:</p>
  
  <hr>
  
  <pre><code>echo "&lt;table width='990' border='1' cellspacing='2' cellpadding='2'&gt;";
  
  $racedetails = mysql_query("SELECT * 
      FROM race_info
      WHERE meetingID = ('" . $safemeetingID . "')");
  
  while($row = mysql_fetch_array($racedetails))
  {
      echo "&lt;tr&gt;&lt;td&gt;Race " . $row['race_number'] . " at " . $row['start_time'] . " " . $row['class'] . " over " . $row['distance'] . "m&lt;/td&gt;&lt;/tr&gt;";
  
      $racecard = mysql_query("SELECT *
          FROM race_form
          INNER JOIN race_info ON race_form.raceID = race_info.raceID
          WHERE race_form.raceID = ('" . $row['raceID'] . "')");
  
      while($row = mysql_fetch_array($racecard))
      {
          echo "&lt;tr&gt;&lt;td&gt;" . $row['number'] . "&lt;/td&gt;&lt;td&gt;" . $row['past10'] . "&lt;/td&gt;&lt;td&gt;" . $row['horse_name'] . "&lt;/td&gt;&lt;/tr&gt;";
      }
  
      echo "&lt;/table&gt;&lt;br&gt;";
  
      echo "&lt;br&gt;I wish I could put in some horse form here...&lt;br&gt;";
  
      echo "&lt;table width='990' border='1' cellspacing='2' cellpadding='2'&gt;";
  
  }
  
  echo "&lt;/table&gt;";
  </code></pre>