Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Current top search terms
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Current top search terms

 Post Reply Post Reply
Author
WebDever View Drop Down
Newbie
Newbie


Joined: 28 September 2003
Location: United Kingdom
Status: Offline
Points: 36
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebDever Quote  Post ReplyReply Direct Link To This Post Topic: Current top search terms
    Posted: 01 December 2003 at 9:43am

Hi ALL,

Can somebody help me, i've set up a search app, going through a database but i would like to display the 'Current top search terms' on the frontpage how would i do this?

Please, please, please can you help me

Thank you for help

Back to Top
Boecky View Drop Down
Groupie
Groupie
Avatar

Joined: 23 December 2002
Location: Belgium
Status: Offline
Points: 110
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boecky Quote  Post ReplyReply Direct Link To This Post Posted: 01 December 2003 at 1:58pm
hmm...count the clicks of the links that found via the search and display the top 5 of most clicked items. Is this what you mean?
Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post Posted: 01 December 2003 at 4:54pm

store the search terms that were searched in a database. make sure you check for doubles... if the term was already searched then increment a field in the database (something like "timessearched"). then just pull the top five searched terms on your homepage

 

Back to Top
WebDever View Drop Down
Newbie
Newbie


Joined: 28 September 2003
Location: United Kingdom
Status: Offline
Points: 36
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebDever Quote  Post ReplyReply Direct Link To This Post Posted: 02 December 2003 at 2:25am

Sorry, i have to ask.

How do you do that exactly? If it's not too much trouble

Thanks for your help

Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post Posted: 02 December 2003 at 1:35pm

it's no problem at all. i'll write a quick example... i can't guarentee that it'll have zero errors, but it'll give u the idea

<%
Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.provider = "Microsoft.Jet.OLEDB.4.0" 'access 2000 database
conn.open "c:\mydatabase.mdb" 'database path

Dim rs
Set rs = Server.CreateObject("ADODB.Recordset") 'create a recordset
rs.open "SELECT * FROM [tblCount] WHERE searchterm = '" & Request.QueryString("searchterm") & "';", conn 'open up a recordset

'If it found a record with the search term then that means
'it's already been searched, if it didn't, it's a new term
If rs.EOF and rs.BOF then
   'it's a new term, add it to the database
   conn.execute("INSERT INTO tblCount (term, counted) VALUES ('" & Request.QueryString("searchterm") & "', '1');")
Else
   'it's already been searched
   rs.movefirst
   Dim varCount
   varCount = rs.fields("counted")
   varCount = varCount + 1
   conn.execute("UPDATE tblCount SET counted = '" & varCount & "' WHERE term = '" & Request.QueryString("searchterm") & "';")
End If

'clean up
Set rs = NOTHING
conn.close
Set conn = NOTHING
%>

change the necessary things in the script. put this in your search script (as long as your search term is under "searchterm" in the querystring... if not then change it)

on your homepage, put something like this where you want to display your top 5 results...

Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.provider = "Microsoft.Jet.OLEDB.4.0"
conn.open "c:\mydatabase.mdb"

Dim rs
Set rs = Server.CreateObject("ADODB.recordset")
rs.open "SELECT * FROM tblCount ORDER BY counted DESC", conn

Dim i
i = 5

While i > 0
   Response.Write rs.fields("term")
   Response.Write "<br>"
   i = i - 1
   rs.movenext
Wend

'clean up
conn.close
Set conn = NOTHING
Set rs = NOTHING
%>

Back to Top
WebDever View Drop Down
Newbie
Newbie


Joined: 28 September 2003
Location: United Kingdom
Status: Offline
Points: 36
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebDever Quote  Post ReplyReply Direct Link To This Post Posted: 03 December 2003 at 4:42am

Are you top end developer or something? you must be a bloody genius!!!

Thanks for your help mate, you really have helped me out

Cheers,

Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post Posted: 03 December 2003 at 1:16pm
any time
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.