Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » best way to do a seach in my own site
Closed Thread
Old 11-21-2005, 04:29 AM   #1 (permalink)
 
Newb Techie

Join Date: Aug 2005

Posts: 20

hargi22

Question best way to do a seach in my own site

hi all,
looking for some help or ideas.
got a website to do, at the moment its in just one big table but i have to make it so that it can be searched.
the problem is that there is 60 or so support staff and the website is to allow new members of staff or whoever to type in a textbox something like " refreshments" and the page or popup window with the person they should contact about refreshments will appear. any ideas on how to do this?
I am advised against PHP and Mysql as it may be a even bigger task getting this installed on the web server due to our network manager not liking them? thouh if this is the only way then he will have to be talked round.
any sample code for this problem would be good to.
matt
hargi22 is offline  
Old 11-22-2005, 08:54 AM   #2 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default

classic asp with sql or an access db

utilize a ado connection, write the script in vbscript

sample code, sorry for the lack of comments

Code:
<html>
<body OnLoad="document.getname.agentname.focus();" bgcolor=#cfcfd7>
<div id="Instructions" style="display:none;">
  1. Enter any part of the agency name to show a list of agencies. For instance, entering salem will show all agencies with salem in their name
  2. Next, find the code for the agency you wish to lookup, click Back to Agent Lookup
  3. Then, click search by agent code and enter the code you found.
</div> <input type=button onclick="document.getElementById('Instructions').style.display=(document.getElementById('Instructions').style.display=='block')?'none':'block';" value="Show/Hide Instructions"> <form action=" <%= request.servervariables("URL") %>" method="get" name="getname"> <input type="hidden" name="action" value="getlist"> <input type="text" name="agentname"> <input type="submit" value="Get List"> <input type="button" onclick="window.location = 'http://sus/tasks/agent%20lookup.htm'" value="Back to Agent Lookup"> </form> <% dim conn, rs, tries, routefile routefile = "\\sus\tasks\actagt2.mdb" 'LOCATION OF THE ROUTE FILE' sub openconn ' open a connection to access db' dim tries set conn = CreateObject("ADODB.Connection") 'prep connection' set rs = CreateObject("ADODB.Recordset") ' prep recordset' tries = 0 ' clear tries counter' do 'try to open connection to the db conn.open "DRIVER={Microsoft Access Driver (*.mdb)};" &_ "DBQ=" & RouteFile & ";DefaultDir=;UID=;PWD=;" tries = tries + 1 if (err.number <> 0) then 'if errored, close this connection conn.close end if Loop While (Err.Number<>0) And tries < 10 'if errored, try again. MAX TRIES = 10 end sub sub closeconn ' close the connection to the db rs.close set rs = nothing conn.close set conn = nothing end sub if Request.QueryString("action") = "getlist" then 'WAS A NAME ENTERED?' openconn 'OPEN CONNECTION TO DB' query = "Select code, name from agents where name like '%" & Request.QueryString("agentname") & "%'" 'SETUP QUERY' 'response.write query 'DISPLAY QUERY FOR DEBUG' rs.open query, conn 'RUN QUERY' if rs.eof then 'IF NO RECORDSET, DISPLAY NONE FOUND' response.write " <font size=+2 color=red>Name Not Found</font></p>" else %> <table border="1" cellspacing="2" cellpadding="2"> <thead> <tr> <th>Agent Code</th> <th>Agency Name</th> </tr> </thead> <tbody> <% Do While Not rs.EOF %> <tr> <td><%= rs.Fields("CODE").Value %></td> <td><%= rs.Fields("NAME").Value %></td> </tr> <% rs.MoveNext Loop %> </tbody> </table> <% end if closeconn 'CLOSE THE CONNECTION TO THE DB' 'response.write "conn closed" 'NOTIFY THAT THE DB WAS CLOSED' end if %> </body> </html>

office politics is offline  
Old 11-30-2005, 05:20 PM   #3 (permalink)
 
Ultra Techie

Join Date: Oct 2003

Posts: 544

fitzjj

Default

have you looked at htdig
fitzjj is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On