Solved

Searching unrelated tables via join query / Linking to different "detail" pages depending on table particular result is from

Posted on 2007-03-23
10
179 Views
Last Modified: 2010-05-18
Hi!  I have a search engine on my site where I need to return results from several different tables that are NOT related.  This is a furniture site so i have a table for the actual furniture, available fabrics, top finishes and availabe trims.  The database is in MS Access so I wrote a query in access to join all 4 of the tables.  I then created a recordset in Dreamweaver to search that query and return the results through a repeat region.  That is working great.  Here is my problem...

Each item that comes up in the repeat region on the results page has a thumbnail image and a style number.  Each of these link to the "details" page for that particular ID.  That is working fine for the Furniture.  But when I click on a Finish, Fabric or Trim in the results page, it sends the right ID number but pulls the result from the Furniture Table.  What I need to do is have 4 separate detail pages (which I already have built) and go to them depending on which item is clicked.  How can I achieve this?  As the Query does not have any info as to the table name how can I differentiate between them?

Here is the link code that is on the thumbnail and style number for each item in the results page:

Detail.asp?<%= MM_keepNone & MM_joinChar(MM_keepNone) & "ID=" & rsFC.Fields.Item("SearchID").Value %>

Furniture results should be sent exactly as is but:
     - Fabric results should be sent to LargeFabric.asp instead of Detail.asp
     - Finish results should be sent to LargeFinish.asp
     - Trim results should be sent to LargeTrim.asp

Thanks,
Scott
0
Comment
Question by:aswhitehead
  • 2
  • 2
  • 2
  • +1
10 Comments
 
LVL 18

Expert Comment

by:mgfranz
ID: 18780409
How are you creating the <a href> tag?  Does it get built dynamically?  I would think a simple loop that creates the HREFs would be able to send the values to the correct page.  When the links are created just set the correct page and values.  Unless I'm missing somethign this is a pretty simple fix.
0
 
LVL 50

Expert Comment

by:Lowfatspread
ID: 18781324
if the query doesn't differentitate between the different data types then
you can't do anything ...

amend the query to indicate / include a reference to the type or page name...
0
 

Author Comment

by:aswhitehead
ID: 18781866
mgfranz,

Here is the code for the <a href> tag:
<a href="Detail.asp?<%= MM_keepNone & MM_joinChar(MM_keepNone) & "ID=" & rsFC.Fields.Item("SearchID").Value %>"><%=(rsFC.Fields.Item("SearchStyle").Value)%></a>

The "Detail.asp" is hardcoded into the page.

Scott
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:aswhitehead
ID: 18781876
Lowfatspread:

So put a column in the query that designates the asp page to go to for each category?  How would I use that info to replace the Detail.asp in my <a href> tag?

Scott
0
 

Expert Comment

by:alicia1234
ID: 18781921
Could you just add something like & gotopage=1 to the query string? Where "1" would tell the receiving page to use "LargeFabric.asp", 2 would mean "LargeFinish.asp", and 3 would mean "LargeTrim.asp" ? Or am I oversimplifying or not understanding the problem?
0
 
LVL 18

Accepted Solution

by:
mgfranz earned 250 total points
ID: 18783692
You are either going to have to NOT hardcode the detail.asp part into the page or make some changes to your db.  My first thought would be to add a field called itemID, populate it with an ID # that matched either the fabric, trim, finish or furniture, such as 1, 2, 3 or 4.  That ID can be passed through the href so the details.asp page would know which other search page to Redirect to.  Then redo the HREF to look like this;

<a href="Detail.asp?<%= MM_keepNone & MM_joinChar(MM_keepNone) & "ID=" & rsFC.Fields.Item("SearchID").Value "& itemID="&rsFC("itemID")& %>"><%=(rsFC.Fields.Item("SearchStyle").Value)%></a>

Now in details.asp, just do a If..Then call for the itemID Redirect;

theID = Request("itemID")
mainID = Request("ID")
If theID = "1" Then
     Response.Redirect "LargeFabric.asp?ID="&mainID &"
ElseIf theID = "2" Then
     Response.Redirect "LargeFinish.asp?ID="&mainID &"
ElseIf theID = "3" Then
     Response.Redirect "Largetrim.asp?ID="&mainID &"
Else ' continue with the details.asp script
...
End If

End If

This way you can still pass the href values to a specific page based on the item ID you created in the db which specified which parameter needs to be searched.

BTW, I build furniture for fun and profit, I would love to see your site, care to share?
0
 
LVL 50

Assisted Solution

by:Lowfatspread
Lowfatspread earned 250 total points
ID: 18784576
return a page name from the query ...  much faster than putting the if into code on the page..

<a href=rsfc.fields.item("PageName")&"?<%= MM_keepNone & MM_joinChar(MM_keepNone) & "ID=" & rsFC.Fields.Item("SearchID").Value "& itemID="&rsFC("itemID")& %>"><%=(rsFC.Fields.Item("SearchStyle").Value)%></a>
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question