Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
Medium Priority
?
185 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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 1000 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 1000 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

636 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