Estoy intentando hacer un inner join en una tabla con un ciclo while, estoy muy verde todavía, me gustaría alguien que explicara un poco como resolverlo en este caso, quiero que en la columna de genero no me salga el numero de ID sino el nombre.
Aquí el código:
<table class="table table-striped">
<th>ID</th>
<th>Nombre</th>
<th>Grupo o Artista</th>
<th>Genero</th>
<th>Imagen</th>
<th>Precio</th>
<th></th>
<th></th>
<?php
$sel = $con->query("SELECT id, nombre, grupoartista, idgenero, imagen, precio FROM productos");
while ($fila = $sel->fetch_assoc()) {
?>
<tr>
<td><?php echo $fila['id']; ?></td>
<td><?php echo $fila['nombre']; ?></td>
<td><?php echo $fila['grupoartista']; ?></td>
<td><?php echo $fila['idgenero']; ?></td>
<td><?php echo $fila['imagen']; ?></td>
<td><?php echo $fila['precio']; ?></td>
<td><a href="actualizar.php?id=<?php echo $fila['id'] ?>">Editar</a></td>
<td><a href="borrar.php?id=<?php echo $fila['id'] ?>">Eliminar</a></td>
</tr>
<?php
}
?>
</table>
Un Saludo
SELECT productos.id, productos.nombre, productos.grupoartista, productos.idgenero, genero.nombre, productos.imagen, productos.precio FROM productos INNER JOIN genero ON productos.idgenero = genero.idgenero