从我的数据库中选择多个STEAMID

I need a little help. I am working on this page, and I am wondering how I can display all STEAMID's and Nicknames that match the nick variable. I currently use the LIKE = '%$nick%' to find the matching nickname, but if two players are called Sidewaykill, it will only display one, but I want it to display all. I don't really care about how it looks, just so long as it displays all matching player Nicknames and STEAMID's. Thank you.

<?php
//Get STEAMID from steamid variable
$nick = mysql_escape_string(stripslashes($_GET["nick"]));
$steamid = $_GET["steamid"];
?>

<!DOCTYPE html>
<html><head><title>Searching for a player steamid</title>
</head>
<body>
<?php

//Connect to database

$sqluser = "----";
$sqlpass = "----";
$hostname = "localhost"; 

//connection to the database

$dbhandle = mysql_connect($hostname, $sqluser, $sqlpass) 
 or die("Unable to connect to MySQL");

//select a database to work with

$selected = mysql_select_db("versound_store",$dbhandle) 
  or die("Could not select database!");

//Attempt to find player SteamID

   $sql1 = "SELECT steamid FROM `vxp_users` WHERE nick LIKE '%$nick%'";
   $res1 = mysql_query($sql1) or trigger_error(mysql_error());
   $row1 = mysql_fetch_assoc($res1);
   $steamid2 = $row1['steamid'];

//Find latest recorded Nickname

   $sql2 = "SELECT nick FROM `vxp_users` WHERE steamid = '$steamid2'";
   $res2 = mysql_query($sql2) or trigger_error(mysql_error());
   $row2 = mysql_fetch_assoc($res2);
   $nick23 = $row2['nick'];



   if (!empty($steamid2)) {

//Write Info

    echo $nick23;
    echo '&nbsp;-&nbsp;';
    echo $steamid2;
    //echo '<br /><br />Last Recorded Steam Name:&nbsp;';
    //echo '<br /><br />Current Steam Name:&nbsp;';
    //echo $currentsteamname;
    echo '<br /><br /><a href="http://versound.org/finder/steamidtoprofile.php?steamid=';
    echo $steamid2;
    echo '" target="_blank">Link to Steam Profile</a>';


   }
   else 
   {
      echo 'The player&nbsp;';
      echo '"';
      echo $nick;
      echo '"';
      echo '&nbsp;was not found in the database. Make sure you have correctly entered their nickname.';
    }
?>
</body>
</html>

You need to loop:

while ($row1 = mysql_fetch_assoc($res1)) {
    echo $row1['steamid']; // or store in an array etc.
}

Where you have this line:

$row2 = mysql_fetch_assoc($res2);

You should replace it with a loop. Each time you call mysql_fetch_assoc() it will bring the next row - so you'd use something like this:

while ($row = mysql_fetch_assoc($res2)) {

See the documentation for more details.

WARNING: These functions are deprecated from PHP 5.5 - you'll have a much better time in the long run using mysqli or PDO.