Displaying the top 10 search phrases searched for on a site.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Breana
    New Member
    • Aug 2007
    • 117

    Displaying the top 10 search phrases searched for on a site.

    I am trying to add this to the search page so it shows the users the top 10 items searched for... like this.

    Top 10 Searches:
    ( free, invincible, lvl skip, skin mod, car, toy, controller, sexy, buy)

    [PHP]<?php

    $sql = "select * from search_terms order by count desc limit 0,10";

    $result = mysql_query($sq l ,$db);

    if ($myrow = mysql_fetch_arr ay($result)) {

    do {

    printf("<tr>");
    printf("<td width=250>%s</td>", $myrow["term"]);
    printf("<td width=50>%s</td>", $myrow["count"]);
    printf("</tr>");

    } while ($myrow = mysql_fetch_arr ay($result));

    }


    ?>[/PHP]

    It works but don't seem to update the code, with the new search tems i just posted. I want it to show only the new ones not the old ones!
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Breana, please read the Posting Guidelines regarding what makes a good thread title.

    Comment

    • kovik
      Recognized Expert Top Contributor
      • Jun 2007
      • 1044

      #3
      Originally posted by Breana
      It works but don't seem to update the code, with the new search tems i just posted. I want it to show only the new ones not the old ones!
      That's because you likely have a lot of searches on the older terms, so adding new ones doesn't necessarily mean they have the same amount of searches. You should make some sort of filtering by the date.

      Comment

      Working...