?
Solved

Need help with syntax for a passed parameter...

Posted on 2006-04-23
3
Medium Priority
?
165 Views
Last Modified: 2013-12-24
I'm an experienced programmer but I am new to ColdFusion.

I have this line in my code ...

<a href="recipe_page.cfm?varID=7"class="linktext">Medley of Brown &amp; Wild Rices</a>      

It's actually in the page recipe_page.cfm ... basically, I'm in a recipe page (which is totally dynamic) and I want to click on a link to go to another recipe. I was testing it with my recipe #7.

The "7" is available in a recordset ...  
#rs_SidesDetail.Side#

What is the proper syntax for me to replace the "7" in my line of code with the value that is in the field?
I've tried a few "obvious" syntaxes but haven't hit on the right one yet!
Thanks.
0
Comment
Question by:alicia1234
  • 2
3 Comments
 

Author Comment

by:alicia1234
ID: 16521197
I have to expand my question:

In the line of code previously mentioned ...
<a href="recipe_page.cfm?varID=#URL.varID#" class="linktext">Medley of Brown &amp; Wild Rices</a>      
"Medley of Brown .... " is also available in a field and I need help with what to replace that text with to make it dynamic.

Here is my table setup:

tblRecipes
   RecipeID  (primary key)
   RecipeName
   ...  (other fields but they aren't relevant to this question)

tblSides
   SideID
   RecipeID
   Side

The tables are related by RecipeID

So in tblSides, "RecipeID" would be the key for me to find the RecipeName in tblRecipes.
0
 
LVL 7

Accepted Solution

by:
wytcom earned 1000 total points
ID: 16521505
Not sure of your specifics.  

General approach is to get field values from query:
<cfquery datasource="dsRecipes" name="qryRecipes">
SELECT recipeID, recipeName FROM tblRecipes
</cfquery>

Then use these to build your page
<cfoutput query="qryRecipes">
<a href="recipe_page.cfm?varID=#qryRecipes.recipeID#" class="linktext">#qryRecipes.recipeName#</a>  
</cfoutput>
0
 
LVL 7

Assisted Solution

by:wytcom
wytcom earned 1000 total points
ID: 16521519
In your action page you get the selected recipe in the url variable:

<cfset theRecipeID = url.varID>

<cfquery datasource="dsRecipes" name="qrySides">
SELECT sideID, side FROM tbleSides WHERE recipeID = #theRecipeID#>
</cfquery>

<cfoutput query="qrySides">
<div>#qrySides.side#</div>
</cfoutput>
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

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

When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
What You Need to Know when Searching for a Webhost Provider
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

850 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