title: How do I loop through a PHP array containing data returned from MySQL?
body: <p>Ok I have a table with a few fields. One of the fields is <code>username</code>. There are many times where the <code>username</code> is the same, for example:</p>
  
  <ol>
  <li><ul>
  <li>username: bob </li>
  <li>password: bob </li>
  <li>report: 1 </li>
  </ul></li>
  <li><ul>
  <li>username: bob </li>
  <li>password: bob </li>
  <li>report: 2</li>
  </ul></li>
  </ol>
  
  <p>I did a SQL statement to <code>select * where username='bob';</code> but when I do the following PHP function, it will only return the last result:</p>
  
  <pre><code>$thisrow = mysql_fetch_row($result);
  </code></pre>
  
  <p>I need to get every field from every row. How should I go about doing this?</p>
  
  <pre><code>$mainsection="auth"; //The name of the table
  $query1="select * from auth where username='$user'"; 
  $result = mysql_db_query($dbname, $query1) or die("Failed Query of " . $query1);  //do the query
  $thisrow=mysql_fetch_row($result);
  echo "Study: " . $thisrow[1] . " - " . $thisrow[5];
  </code></pre>
  
  <p>Sorry for such a dumb question. I can't seem to get the <code>while</code> loops of more than one field working for the life of me.</p>