I have to compare if the numbers in table A exist in table B being that if there is one statement but another one. I tried this and it did not work, it does not return anything else.
Note: Table B may not have codigo
of table A
EXAMPLE:
TABELA A campo => (codigo): 12,13,23,44,55
TABELA B campo => (meucampo): 13,44,55
$sql_A="SELECT * FROM A";
$resultado_A = $conexao->query($sql_A);
while($row_A = $resultado_A->fetch_assoc()) : ?>
$sql_B="SELECT * FROM B WHERE meucampo = ".$row_A['codigo']." ";
$resultado_B = $conexao->query($sql_B);
while($row_B = $resultado_B->fetch_assoc()) :
if($row_A['codigo'] == $row_b['meucampo']) :
echo"<a href='link'>foo</a>";
else :
echo"<a href='link'>foo/bar</a>";
endif;
endwhile;
endwhile;