First of all you will have to know about the "AND" clause. Your query is saying that "selct a row from table where first name should be "Ryan" and the second one should be BLANK". And if there is a row in your databse with first name "Ryan" and second name is "Decosta" then how it should return this row? It will search only where Second name is "BLANK".
for this kind of query you need to make it your sql query first the execute it. for example...
$add_sql='';
if($last_name!='')
{
$add_sql=" AND last name = '$last_name'";
}
$result = mysql_query ("SELECT * FROM bbcomp
WHERE first_name = '$first_name'
$add_sql");
This is just a trick
Enjoy
Tabish