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
176 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

705 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now