In PHP how do I appear instead of the foreign key id, appear the field that owns the data?
My has the group table column id_grupo
%% and column grupo_nome
.
I have the product table there is the products of the groups that signed up in another table, but when I put to display in php instead of the name is showing the group number.
This is code I learned to call the table data
Product table
prod_id|prod_nome |prod_grupo
1 |Rebite Pop 406| 1
2 |Rebite pop 406| 2
Group table
grupo_id | grupo nome
1 | alumínio
2 | inox
This code on my php page
<?php
include("conexao.php");
$consulta = "SELECT * FROM cadastro_produtos";
$con = $conn->query($consulta) or die($conn->error);
?>
<?php while($dado = $con->fetch_array()){ ?>
<tr>
<td><?php echo $dado["prod_id"];?></td>
<td><?php echo $dado["prod_nome"];?></td>
<td><?php echo $dado["prod_grupo"];?></td>
</tr><?php } ?>
<td><?php echo $dado["prod_grupo"];?></td> aparece o numero, como faço para aparecer o nome do grupo ?
Thank you