If i understand you correctly you are doing something similar to what I am doing and you can use something similar to this
// Your Query
$resultID = mysql_query("SELECT * FROM items WHERE name LIKE '%$nameofitem%'", $link);
//tells how many rows and puts in $total_items
$total_items = mysql_num_rows($resultID);
// For loop parsing the table
for($x = 1; $x <= mysql_num_rows($resultID); $x++)
{
print ( "<!-- Error occured: " . mysql_error() . " -->");
// putting in array
$row = mysql_fetch_assoc($resultID);
print "<tr>\n";
print "<td>" . $row[item_id] . "</td>\n";
print "<td><a href=\"viewitem.php3?item_id=" . $row[item_id] . "\"><b>" . $row[name] . "</b>\n";
print "<td>" . $row[type] . "</td>\n";
print "<td>" . $row[classification] . "</td>\n";
print "</tr>\n";
}
print "</table>\n";
$row[<field name here>] will get the value of that field name in order of your key id i believe. and you can use the variable within the html as you see above.
Hope this helps,
Tyrnt