I have made a search of the User Items (my site is a game) and made it containing phrase. I want it to show just one type of item at a time if there is more than one match and it doesn't seem to be doing that.

PHP Code:
if ($_POST['type'] == "containing")
 {
 
$get_matches mysql_query("SELECT * FROM tblItems");
print 
"<table border=1 cellpadding=6 cellspacing=0 align=center width=700><tr><td width=25% align=center><b>Shop</b></td><td width=50% align=center><b>Item</b></td><td width=5% align=center><b>Stock</b></td><td width=20% align=center><b>Price</b></td></tr>";
  while (
$matches mysql_fetch_array($get_matches))
  {
if (
preg_match("/".$_POST['item']."/i" $matches['name']))
{
$status "$matches[name]";
}
$get_item mysql_fetch_array(mysql_query("SELECT * FROM tblItems WHERE name = '$status' ORDER BY RAND() LIMIT 1"));
$get_search_stuff mysql_query("SELECT * FROM tblUserShopsItems WHERE type_id = '$get_item[itemtypeid]' ORDER BY price ASC LIMIT 50");
while (
$result mysql_fetch_array($get_search_stuff))
{
$result2 mysql_fetch_array(mysql_query("SELECT * FROM tblUserShops WHERE username = '$result[username]'"));
$result3 mysql_fetch_array(mysql_query("SELECT * FROM tblItems WHERE itemtypeid = '$result[type_id]'"));
print 
"<tr><td width=25% align=center><a href=""http://venetopia.com/user_shop.php?owner=$result[username]><b>$result2[title]</b></a></td><td width=50% align=center>$result3[name]</td><td width=5% align=center>$result[instock]</td><td width=20% align=center>$result[price]</td></tr>";
}
  }
  print 
"</table>";
 }