title: MySQL query within another query's while loop in PHP
body: <p>I have the following code:</p>
  
  <pre><code>$query = mysql_query("SELECT * FROM activity ORDER BY activity_time DESC LIMIT 50");
  while($result = mysql_fetch_array($query)) {
      extract($result);
      if ($activity_type == "discussion") {
  
          $query = mysql_query("SELECT * FROM discussions WHERE discussion_uuid = '$activity_ref'");
          while($result = mysql_fetch_array($query)) {
              extract($result);
              echo $discussion_user . " said:&lt;br&gt;" . $discussion_text . "&lt;br&gt;";
          }
  
      } elseif ($activity_type == "file") {
  
      }
  }
  </code></pre>
  
  <p>But it just returns the last row. My goal is to have a chronological list of "activities" each displayed slightly differently depending on their type.</p>