• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 190
  • Last Modified:

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

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
aswhitehead
Asked:
aswhitehead
  • 2
  • 2
  • 2
  • +1
2 Solutions
 
mgfranzCommented:
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
 
LowfatspreadCommented:
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
 
aswhiteheadAuthor Commented:
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.

 
aswhiteheadAuthor Commented:
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
 
alicia1234Commented:
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
 
mgfranzCommented:
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
 
LowfatspreadCommented:
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

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.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now