2
Good morning,
my doubt is as follows: in my case I have a table in the database that allows to evaluate a service, the classification is made by colors "red, yellow and green", ie the type is text
.
What I wanted was to make a query
in php
that allows counting how many "green", "yellow" and "red" are inserted.
This is the table:
What I want is for example no day 06-06 there were 3 greens, 2 yellows and 1 red, and no day 07-06 there was 1 green. In question to date, I have a calendar I made with jquery and Ajax.
I tried something like this
$verificar=mysqli_query($link,"SELECT classificacao, count(classificacao) from questionario GROUP by classificacao");
while ($linha = mysqli_fetch_array($verificar)) {
if($linha['classificacao'] == 'vermelho')
{
$output.='<td style="background-color:#ff6666; text-align: center; padding: 8px; font-weight: bold;">'.$linha['classificacao'].'</td>';
}
elseif($linha['classificacao'] == 'amarelo')
{
$output.='<td style="background-color:#ffff80; text-align: center; padding: 8px; font-weight: bold;">'.$linha['classificacao'].'</td>';
}
elseif($linha['classificacao'] == 'verde')
{
$output.='<td style="background-color:#80ff80; text-align: center; padding: 8px; font-weight: bold;">'.$linha['classificacao'].'</td>';
}
$output.='
</tr>
';
}
However it does not return any value, can anyone tell me what is wrong? Thank you from now who can help!
This classification column, you save the color name or color in Hexadecimal?
– Rafa
Name of the colour Rafa
– Ana