Good morning!
I wanted to calculate the percentage of how many times a rating appears between two dates, the ratings are distributed in "red," "yellow," and "green."
This is the "questionnaire" table:
Itrieditasfollows:
$percentagem_verm=mysqli_query($link,"SELECT COUNT(q.pergunta_id) / t.total * 100 as perc, classificacao FROM questionario q,
( SELECT COUNT(*) AS total FROM questionario) t
WHERE q.classificacao = 'vermelho' AND data BETWEEN '".$_POST["datainicial"]."' AND '".$_POST["datafinal"]."'
GROUP BY q.classificacao "));
The dates I get by the URL and works fine, however the percentage that returns is wrong, it is only correct when I choose all the information in the database, but if it is a specific date everything is wrong ...
p>