Author |
Topic  |
|
sogoth
New Member

United Kingdom
73 Posts |
Posted - 02 August 2001 : 08:38:41
|
That may sound confusing. Let me explain.
I need to find out how to create a page that allows a search of the database (not a problem) but then it should allow a search *within* the confines of the previous search.
Say I searched a database for all uk contacts, removing all contacts elsewhere in the world. Now I want to limit the results even more by searching for anyone named fred that lives in the UK without having to re-search for UK
I hope that makes sense!
Paul - Complete Muppet, Borderline Feeble! |
|
Spoon
Average Member
  
Ireland
507 Posts |
Posted - 02 August 2001 : 09:29:16
|
quote:
That may sound confusing. Let me explain.
I need to find out how to create a page that allows a search of the database (not a problem) but then it should allow a search *within* the confines of the previous search.
Say I searched a database for all uk contacts, removing all contacts elsewhere in the world. Now I want to limit the results even more by searching for anyone named fred that lives in the UK without having to re-search for UK
I hope that makes sense!
Paul - Complete Muppet, Borderline Feeble!
Hmm, in theory you could do this.
When the user searches, give them a session with a unique ID. I presume every field you have has an ID. Now write those IDs to a new query string. (do a loop to write the SQL stmt.)
Then have some sort of a link with a querystring that triggers the search within those fields.
You understand me?? Write back if it workd or doesnt. Id like to know either way.
Regards - Spoon
Begineer? Need help installing the forums? - www.aslickpage.com/snitz_help.html
www.ASlickPage.com - Private Messaging |
 |
|
sogoth
New Member

United Kingdom
73 Posts |
Posted - 02 August 2001 : 09:35:09
|
>When the user searches, give them a session with a unique ID. I presume every >field you have has an ID. Now write those IDs to a new query string. (do a >loop to write the SQL stmt.)
Eeeeeeeeeerrrrm... I'm lost I'm afraid :
Paul - Complete Muppet, Borderline Feeble! |
 |
|
Spoon
Average Member
  
Ireland
507 Posts |
Posted - 02 August 2001 : 10:21:29
|
Sorry, i was in two minds there. Say this is your search results.
================================ ID | NAME | PHONE_NUMBER ================================ 01 | ssss | 43984790238492 02 | dddd | 23432432423423 03 | dsfs | 32423423423432
Youve pulled those results out of the database. Now as you are writing them, write your sql aswell
eg.
<% SQLSEARCH = "SELECT FROM USERS WHERE " COUNTER = 1 Do while NOT RECORDSET.EOF %>
<%=RECORDSET("ID")%> | <%=RECORDSET("NAME")%> | <%=RECORDSET("PHONE")%><br>
<% IF NOT COUNTER = 1 Then SQL SEARCH = SQLSEARCH & "OR " End If
SQLSEARCH = SQLSEARCH & "ID=" & RECORDSET("ID")
COUNTER = COUNTER + 1
RECORDSET.Movenext Loop %>
Now pass the sql stmt in a querystring.
<a href="page.asp?SEARCH=WITHIN&SEARCHFOR=<%=SQLSEARCH%>">Search with results</a>
Then just request it and use it as your search within search SQL stmt. eg.
If Request.Querystring("SEARCH") = "WITHIN" Then SQL = Cstr(Request.Querystring("SEARCHFOR"))
That might work for you. Its the first time ive ever attempted to code something like that. Hope it works. Let me know
(Sorry about the sessions and stuff above. I was not in the right mind.!)
Regards - Spoon
Begineer? Need help installing the forums? - www.aslickpage.com/snitz_help.html
www.ASlickPage.com - Private Messaging
Edited by - spoon on 02 August 2001 10:25:45 |
 |
|
|
Topic  |
|