April 25th, 2000, 06:13 AM
I have a database-table that stores information on refering urls to a site.
Each referer is stored like:
"http://www.theengine.com/search/search.php?q=Visitors+Query" (bogus-url, searchengines look pretty much like this)
"http://www.directory.com/Cat_1/Cat_2/Cat_3" (bogus-url, directories look pretty much like this)
Every time a referer is stored, it's flagged as being "U" (unknown), and if i don't get a url, it's flagged as "Sp" (spider - which is not always the case, but if it isn't referred, i don't want it in my stats). When i fire up my report-script, all entries marked as "U" gets compared with known directories (in separate table) and known searchengines (also in a separate table), and if i get a match in the directory-table, it gets reflagged as "D" and if it's in the searchengine-table, it gets reflagged as "S", otherwise it stays as "U".
i use parse_url() to get the url, like:
$my_url = parse_url($result);
and then i match $my_url["host"] against the tables with something like this:
$my_host = $my_url["host"];
$my_query = "
SELECT searchengine_id FROM Searchengine
WHERE searchengine_url LIKE '%$my_host%'";
$my_result = mysql_query($my_query)
or die("- Couldn't perform:<br><b>$my_query</b><br><br>");
and then i reflag it in the table containing the referers.
Now i need to extract the keywords from all referers flagged as "S"... i know that $my_url["query"] contains the query part from the referring url, but what i need to do is take _each_ keyword and match it against other entries in the referer-table flagged with the "S", and count the number of referers containing that specific keyword, store the keyword and count in an array, and move on to the next keyword, repeat the procedure for all "S"-flagged entries, and make sure i don't count the same keyword several times ...
Any ideas anyone? I'm getting confused ..
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Linux, the operating system with a clue - Command Line User Environment.[/quote]