0
I need urgent help, I’m doing a database query on several different array. When the information with "implode" and picked up again with "explode", however, I get repeated values and I wanted the same function of "SELECT DISTINCT". Does anyone know how to fix it? Code:
<h4>Cores</h4>
<?php
while($row_mestre = mysqli_fetch_assoc($matrizMestre))
{
$CorNormal = $row_mestre["CorProduto"];
if(strpos($CorNormal,",") == FALSE)
{
$CorFinal = $CorNormal;
echo '<input type="checkbox" name="CorConsulta[]" value="$CorFinal[$j]"/>'. $CorFinal.'<br/>';
}
else
{
$CorFinal = explode(",",$CorNormal);
if (is_array($CorFinal))
{
for($j=0;$j<sizeof($CorFinal);$j++)
{
echo '<input type="checkbox" name="CorConsulta[]" value="$CorFinal[$j]"/>'. $CorFinal[$j].'<br/>';
}
}
}
}
?>
</div>
Table images and how it is shown https://imgur.com/a/ZmvPb
Why are you saving the comma separated values? I believe your case is pertinent to a data normalization
– Gabriel Heming
I am doing this because in the store, the same product can have more than one color. I see no other way to do this
– Eduardo Ferreira
I gave one studied and managed to do the normalization. It was a small tip but it helped a lot!
– Eduardo Ferreira