title: How can I output multiple results from a database (if there are any)?
body: <p>I have made a search function which outputs peoples names and their details after searching the first name, but when there are multiple people  with the same first name in the database the output only shows one result.
  Here is my code:</p>
  
  <pre><code>&lt;?php
  include ('connect-db.php');
  if (isset($_GET ['forename'])){
  $forename = $_GET['forename'];
  
  
  $userquery = mysql_query("SELECT * FROM staff WHERE forename = '$forename'") or die ("error getting information from database.");
  if (mysql_num_rows($userquery) == null ){
      die ("No staff directory found");
  }
  while ($row = mysql_fetch_array($userquery, MYSQL_ASSOC)){
      $firstname = $row['forename'];
      $lastname = $row['surname'];
      $email = $row ['email'];
  }
  }
  ?&gt;
  
  &lt;h2&gt;&lt;?php echo strtoupper( $forename )?&gt; &lt;?php echo strtoupper ( $lastname )?&gt;'s Profile&lt;/h2&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
  &lt;table style = "font-weight:bold;
          font-family: Century Gothic,CenturyGothic,AppleGothic,sans-serif;"&gt;
          &lt;hr style="border-top: dotted 1px;" /&gt;
  &lt;tr&gt;&lt;td&gt;First Name: &amp;nbsp &amp;nbsp&lt;/td&gt;&lt;td&gt;&lt;?php echo strtoupper ($firstname) ?&gt; &lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;Last Name:  &lt;/td&gt;&lt;td&gt;&lt;?php echo strtoupper ($lastname) ?&gt; &lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;Email Address:  &lt;/td&gt;&lt;td&gt;&lt;?php echo strtoupper ($email) ?&gt; &lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;Mobile Number:  &lt;/td&gt;&lt;td&gt; #&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;Work Number:  &lt;/td&gt;&lt;td&gt; ##&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;Home Phone:  &lt;/td&gt;&lt;td&gt; ###&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Can anyone tell me what I need to do here as I can't figure out what to add and where.
  Many thanks in advance,
  Danny</p>