I have a few static tags in a table.
And I'm trying to track clicks on the static tags, and i have seen on other sites (and it actually really good) that the popular tags changes is size.
Have a look at this image: This image presents the expected output.
The table looks like this:
+-----------+--------+
| tag | clicks |
+-----------+--------+
| Falun | 45 |
| Stockholm | 229 |
| Borlänge | 77 |
| ... | ... |
| ... | ... |
+-----------+--------+
More clicks, the "bigger" font size. But font size should be max 40px, and min 5px.
How can I from MySQL and PHP calculate difference in clicks and present it in font-size
?
SELECT tag, (SELECT COUNT(percentage) FROM tags) AS tag_size FROM tags
Then
foreach($tags as $tag){
<a href="#" style="font-size: <?php echo $tag->tag_size ?>px"><?php echo $tag->tag ?></a>
}
Very sorry for pseudo code, but i have no idea how to do this!