[I am using an example in this question, the real problem I have is very similar, but it would be too complicated to write it down here 😉 ]
So, I have a database table:
id | text
-------+------------
1 | Google
2 | Yahoo
3 | Google
4 | Bing
5 | Yahoo
6 | Google
7 | Yahoo
8 | Google
I want to SELECT them all and then display them like this:
Google 4
Yahoo 3
Bing 1
So I want to order the phrases by the number of appearances in the database…
It might sound a bit complicated… But I think my problem can be understood with the example.
So what should I do? What is the appropriate code for this in PHP/MySQL?
1 Answer