[php] mysql_query question

I have a DB with two tables, ‘listing’ and ‘brokers’. I have it returning rows from listing in a loop and displaying them correctly and all, the row is stored in the variable $result. I want to take $result_ar[‘lastname’] and use it to such the column ‘lastname’ in ‘brokers’ and return the row when it finds the match. How would I do that. I’ve been working on this for a while now with no results.