Good morning,
my question is this: 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 to do is query
in php
that lets you count how many "green", "yellow" and "red" are inserted.
This is the table:
WhatIintendisforexampleon06-06therewere3green,2yellowand1red,andon07-06therewere1green>.Inissuetodate,IhaveacalendarIdidwithjqueryandAjax.HomeItriedsomethinglikethis
$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>
';
}
But it does not return any value, can someone tell me what is wrong? Thank you right now who can help!