Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Variable in Query

Explorer ,
Mar 20, 2008 Mar 20, 2008
On the top of the page I will have different years like 2008, 2007, 2006, etc...

I want the user to select one of the years and the query would bring up the information for that year. I know it possible I'm very new to this software. I'm thinking that when the page first opens it brings up the current year.

Here is my current code
TOPICS
Getting started
264
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 20, 2008 Mar 20, 2008
If you want it to be a function, add a cfargument tag to that function to accept the year. Make it numeric. Then, in your query, replace the "2007" with #arguments.playeryear#.

Now, about those quotes. First, when submitting queries through odbc/jbdc you single quotes, not double quotes. Secondly, quotes only apply to char/varchar datatypes. Why would a field that could only accept numbers not be numeric?

To run the query, put an anchor tag around the years with a url variable. On the page that is linked to, call your function and send the url variable as an argument.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 20, 2008 Mar 20, 2008
Ok I kinda understand. I'm to new to this and Dreamweaver. OK the field year in the database are numeric. I replaced the 2007 with #arguments.playeryear#. Now adding cfargument tag where and how do I do that.

Thanks for your help.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 20, 2008 Mar 20, 2008
LATEST
Google is your freind. I am not.

To find information about a cold fusion tag, search on "<cftagname> x" where x is the version of cold fusion you are running. Include the angle brackets in your search.

To find information about a cold fusion function, search on "coldfusion name_of_function x". Note that coldfusion is one word.

Almost always, the first pages offered will be right out of the cfml reference manual.

The name of the tag is cfargument.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources