0
I’m looking for data from two tables which have an equal column, which is called the prefix column.
I tried to mount a foreach inside the other foreach with the data of the two tables and comparing the values for when they are equal, ie the prefix was in the two tables changed the color of the button to green, if the prefix(value) is only in a table put the color red, do this along with creating the button through PHP.
<?php
foreach($produtos as $produto) {
?>
<section class="abastecimento">
<button class="pack detail btn" <?php
foreach($abastecimentos as $abastecimento) {
if ($abastecimento['prefixo'] == $produto['prefixo']) {
echo "style='background-color:green'";
}else{
echo "style='background-color:red'";
}
}
?> id="detail"><?php echo trim($produto['prefixo']); ?>
</button>
</section>
<?php
}
?>
The first prefix comes with the color green, the second also in the two tables does not paint.