I want to a Tag cloud that is based on the frequency of search "keywords" that users use in searching a product table in my database.
My search script looks for keyword in Product_description field and product_name field.
PHP Code:
//specify how many results to display per page
$limit 10;

// Get the search variable from URL
$var = @$_POST['q'] ;

//trim whitespace from the stored variable
$trimmed trim($var);

//separate key-phrases into keywords
$trimmed_array explode(" ",$trimmed);
// Build SQL Query for each keyword entered
foreach ($trimmed_array as $trimm){
      
// EDIT HERE and specify your table and field names for the SQL query
     
$query "SELECT * FROM product WHERE product_description LIKE '%$trimm%' OR product_name like '%$trimm%' OR product_category like '%$trimm%' ORDER BY product_description  DESC" ;
     
// Execute the query to  get number of rows that contain search kewords
     
$numresults=mysql_query($query);
     
$row_num_links_main =mysql_num_rows($numresults); 

Am just confuse on how to store keywords from search and retrieve for tag cloud.
can someone help because it's confusing to me