$result = mysql_query ("SELECT * FROM table1
INNER JOIN table2 ON table1.value = table2.value", $db);
if ( mysql_num_rows($result) == 0) { echo "Нет результата"; };
while (
$myrow = mysql_fetch_array ($result)
)
{ printf("%s",$myrow['value']); }