foreach ($results AS $pb) { print "<td>$pb['id']</td>"; print "<td>$pb['users']</td>"; print "<td>"; foreach($cousers as $couser) if($couser['refer'] == $pb['id']) print $couser['campo_que_quieras']; print "</td>";}