I have a query that is calling data from the wrong row.

If I create a new row and do not fill information in some of the rows, it brings the information from a different row that has a different ai unique id.

This is the query.

PHP Code:
$query_profile "SELECT * FROM law_firm , attorney WHERE law_firm.firm_id ='$thisfirm'";
$query_limit_profile sprintf("%s LIMIT %d, %d"$query_profile$startRow_profile$maxRows_profile);
$profile mysql_query($query_limit_profile$assess_remote) or die(mysql_error());
$row_profile mysql_fetch_assoc($profile); 
This is the session variable I am using.
PHP Code:
<?php $thisfirm=$_SESSION['firm_id']; ?>
Someone tell me where I am going wrong?