Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Searching searches
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

sogoth
New Member

United Kingdom
73 Posts

Posted - 02 August 2001 :  08:38:41  Show Profile  Visit sogoth's Homepage
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  Show Profile  Visit Spoon's Homepage  Send Spoon an ICQ Message
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
Go to Top of Page

sogoth
New Member

United Kingdom
73 Posts

Posted - 02 August 2001 :  09:35:09  Show Profile  Visit sogoth's Homepage
>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!
Go to Top of Page

Spoon
Average Member

Ireland
507 Posts

Posted - 02 August 2001 :  10:21:29  Show Profile  Visit Spoon's Homepage  Send Spoon an ICQ Message
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
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 1.3 seconds. Powered By: Snitz Forums 2000 Version 3.4.07