mysql_query("SELECT DISTINCT lo_category FROM questions where question_text = '" . mysql_real_escape_string($_GET["choice"]) . "'");
So from the query above i will get the lo_categories that match with the choice.How do i get the number of categories,eg
Category Cognitive : 3 matches
Category Psychomotor : 1 matches
Category Perception : 0 matches
($_GET["choice"])
is from the html checkbox with multiple choices.
And this is my question table.
question_id question_text keyword lo_category lo_domain
1 Define the word paraphrase Define Knowledge Cognitive
2 describe the meaning of NLP describe Knowledge Cognitive
3 describe the meaning of NLP describe Perception Psychomotor
4 describe the meaning of NLP describe Receiving Affective
5 Define this Define Knowledge Cognitive
Updated with this ,there's error.Please help i'm so lost!!!
$yes=mysql_query("select lo_category, count(*) from questions where question_text='" . mysql_real_escape_string($_GET["choice"]) . "' group by lo_category order by lo_category");
while ($row = mysql_fetch_assoc($yes)) {
echo '<b>Category :</b> ' . $row['lo_category'] . ',' . $row['count(*)'] . '<br />';
}
Please help me i'm a beginner in this..Thanks in advance!!!