I don't understand exactly what you want, as Im not a english spoken guy , be aware of my grammar 😃
You're saying that you make a query looking for the word "test" on a table, and your results return more than one row, but you only want to fectch the first one, right?
if you're using mysql try to use a query like this:
$sql = "select column from table where column like '%TEST%' limit 0,1"
$row = mysql_fetch_array(mysql_query($sql));
echo($row["column"]);
you can also add an ORDER BY clause on your sql query to order the results ...
Hope it helps