I have a web application, which has a form for registering new users; Each user is assigned a unique color, taken from BD (MySQL)
.
I have a users table and a table colors, having two registered users, I want to show the color assigned to each user when displaying the user table; So far I have managed to show the color hexadecimal code, which is the one stored in BD
.
Does anyone know how to read that code and show the color in the cell?
<?php
$tusers = $conexion->query("SELECT * FROM user u LEFT JOIN cat_niveles n ON u.Nivel=n.id LEFT JOIN cat_centros c ON u.ID_CC=c.id LEFT JOIN cat_colores k ON u.id_color=k.id");
$listU = $tusers->fetch_all(MYSQLI_ASSOC);
for ($i=0; $i < count($listU); $i++) {
echo '<tr>';
echo "<td>".$listU[$i]['Nombre']."</td>".
"<td>".$listU[$i]['User']."</td>".
"<td>".$listU[$i]['nombre_nivel']."</td>".
"<td>".$listU[$i]['Nombre_CC']."</td>".
"<td>".$listU[$i]['Fecha_Registro']."</td>".
"<td>".$listU[$i]['has_color']."</td>";
}
?>