title: PHP mysql_fetch_array multiple tables
body: <p>So I have the below code that I'm trying to run partly as a login script, and partly to gather some information for another program. I don't get any errors with the script, I just don't get any information from the second and third mysql_fetch_array which I read is a common problem but that should only apply to the same table. Even so, I followed the recommended advice and used mysql_data_seek to reset the $result. I've also tried using different $result and $row variables but I still don't get any data back from those queries. Any thoughts on how I can do this?        </p>
  
  <pre><code>    $result = mysql_query("SELECT * FROM user WHERE username = '$username'");
      $row = mysql_fetch_array($result);
      $salt = $row['salt'];
      $id = $row['id'];
      $usergroup = $row['usergroupid'];
      $mysql_pass = $row['password'];
      $md5_pass = md5($password.$salt);
      mysql_data_seek ($result, 0);
          if($mysql_pass == $md5_pass)
          {
              $result = mysql_query("SELECT teamid FROM tmnt_members WHERE teamid = '$id'");
              $row = mysql_fetch_array($result);
              $team = $row['teamid'];
              $captain = $row['leader'];
              $cocaptain = $row['coleader'];
              mysql_data_seek ($result, 0);
              $result = mysql_query("SELECT * FROM tmnt_teams WHERE teamid = '$team'");
              $row = mysql_fetch_array($result);
              $teamname = $row['teamname'];
          }
  </code></pre>