i have a problem to count explode function, here is my coding
<?php
$query = "SELECT Indication, COUNT(Indication) FROM reg WHERE Indication IS NOT NULL AND Indication != '' GROUP BY Indication";
$result = mysql_query ($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
$medic = explode(",", $row['Indication']);
for($i = 0; $i < count($medic); $i++){
echo "". $row['COUNT(Indication)'] ." - $medic[$i] ";
echo "<br />";
}
}
?>
and my result is :
a -1
a - 1 b - 1 c - 1
b - 1 c - 1
but i want the answer like this:
a = 2
b = 2
c = 2
can someone help me?