Help grouping and sorting keywords extracted from url

Discussion in 'PHP' started by WeX09, Apr 12, 2011.

  1. #1
    Hello guys,

    I'm not experienced in php, well..., actually I don't have experience in this so that is why I come here so please, help me.

    I'm using the attached code to pull out the visitor ip address and $_SERVER[HTTP_REFERER] ($referer), then, I extract the keywords from $referer. Both tasks are ok, but I'm getting a hard time trying to group and sort those keywords and display those in a table.

    Some help will be appreciated. Thanks in advance.

    $query = ("SELECT referer, browser_ip, date, browser_language FROM visitors WHERE SUBSTRING(browser_language,1,1) != '[' ORDER by date DESC");
    $result = mysql_query($query) or die(mysql_error());
    while ($row = mysql_fetch_array($result)) {
    	
    //-----------------------------------------------------TO EXTRACT KEYWORDS 
    $referer = $row[0];
    IF($referer)
    {
        PREG_MATCH("/[\&\?]q=([^&]*)/", $referer, $matches);
            $search_query = RAWURLDECODE($matches[1]);
            $search_query = STR_REPLACE("+", " ", $search_query);
    PHP:

     
    WeX09, Apr 12, 2011 IP