dtdetu Posted June 20, 2009 Share Posted June 20, 2009 hello i have this function to generate tag clouds in my site <?php function tag_cloud($tags) { $maxsize = 40; $minsize = 20; $maxval = max(array_values($tags)); $minval = min(array_values($tags)); $spread = $maxval - $minval; $step = ($maxsize - $minsize) / ($spread); foreach ($tags as $key => $value) { $size = round($minsize + (($value - $minval) * $step)); echo '<a href="#" style="font-size: '.$size.'px">'.$key.'</a> '; } } $tags = array('php'=>30, 'javascript'=>24, 'java'=>17, 'python'=>26, 'ruby'=>17); tag_cloud($tags); i will use it as search tag cloud generator, in my database there are search keywords. my searches stored invidually , so i think i need to use group by in the query. but i couldnt figure how can i get data from mysql and use in this function. Can someone help me please Quote Link to comment https://forums.phpfreaks.com/topic/163051-solved-mysql-counting-data/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.