PHP-Tabelle mit Comma [diese löschen]
Hier bekommen i mos beliebte Hashtags (mos Hashtags verwendet), aber Problem ist mit Komma meiner Anfrage Diesen:
Popular hashtags:
#q7 (2)
#q9 (2)
#q7 , #q0 (1)
#q0 (1)
Ich möchte dies:
Popular hashtags:
#q7 (3 times)
#q9 (2 times)
#q0 (2 times)
mein Code:
$query_result = mysqli_query($Connection, "select hashtag, count(hashtag) as cnt
from tricks
group by hashtag
order by cnt desc limit 5");
$results = array();
while($row = mysqli_fetch_assoc($query_result)) {
$results[] = "{$row['hashtag']} ({$row['cnt']})";
}
echo "Popular hashtags: </br>", implode("</br>", $results);
print_r ($ ergebnisse); was es zeigt? –
zeigen dies: Beliebte Hashtags: # q7 (2) # q9 (2) # q7, # q0 (1) # q0 (1), aber ist falsch –
beacouse # q7 3times # q9 2times und # q0 verwendet wird Zeiten –