0
In PHP as I do to appear instead of the foreign key id, appear the field that has the data?
My group table has the column id_grupo
and column grupo_nome
.
I have product table there have the product groups I have registered in another table, but when I put to display in php, instead the name is appearing 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
Please friend post the code you are using.
– Emerson Barcellos
Search on
JOIN
andRENAME
, are concepts of a database.– João Sobral
Thanks, I’ll look it up, thanks
– Junior
WHERE group_name = '$group_name'; if you manage to warn...
– MagicHat
I’ll test it here
– Junior
put the tables script
– Fbor
I’ve been reading and Where command is bad for tables with various products
– Junior