Using variable in SQL query

I have a database with 2 tables. I can query the first table and pull all the rows out and then are formating them into a table, similar to the tut here on kirupa. Now what I want to do is take the variable created by the first query and use it to do a second query. So I have $result_ar[‘broker_last_1’] and I want to do:

$broker = mysql_query(SELECT * FROM brokers WHERE lastname = $result_ar[‘broker_last_1’]);

I hope I explained this well and someone could show me how to write the query. thanks in advance