Also - as far as your syntax, you try to do <cfif request = cat> which is
incorrect. Regardless of how you build your query you would have to do <cfif
request EQ "Cat"> the "=" is used for assignment and that is why your code
is blowing up. But, I would also do what Steven suggests. Much cleaner...
Mike
----- Original Message -----
From: "Steven Durette" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Sunday, September 09, 2001 1:28 PM
Subject: Re: Newbie Syntax Help
> You might be able to speed up the query and get it to work if you make a
few
> minor changes.
> In the form instead of :
> marketplace.cfm?request=cat
> marketplace.cfm?request=twn
> marketplace.cfm?request=alpha
>
> change it so the options are:
> marketplace.cfm?request=category
> marketplace.cfm?request=town
> marketplace.cfm?request=busname
>
> Then in the marketplace.cfm file make these changes:
> <CFPARAM NAME="URL.request" DEFAULT="category">
>
> <CFQUERY NAME="GetResults" DATASOURCE="Reminder">
> SELECT * FROM customer
> ORDER BY #URL.request#
> </CFQUERY>
>
> The CFPARAM ensures that there is a value for the url.request variable
> (prevents errors) and the change to the CFQUERY means that it doesn't have
> to evaluate 3 CFIFs.
>
> If for some strange reason you can't do this, then to correct your
original
> code, change <CFIF request = to <CFIF request IS
>
> Steven Durette
> MGR. - Engineering & Construction System Support
> Database Administrator/Web Developer
> Ameritech/SBC
> (810)466-7654 [Office]
> [EMAIL PROTECTED] [work email]
> [EMAIL PROTECTED] [work email]
>
> ----- Original Message -----
> From: "Jeffrey Cohen" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Sunday, September 09, 2001 2:11 AM
> Subject: Newbie Syntax Help
>
>
> > Help!!! Please!!!
> > OK..I'm new at this, so be kind...
> >
> > I have a pulldown menu, that returns a URL like:
> >
> > marketplace.cfm?request=cat
> > marketplace.cfm?request=twn or
> > marketplace.cfm?request=alpha
> >
> > Then, in marketplace.cfm, I am trying to ORDER BY the variable above,
like
> >
> >
> > <CFQUERY NAME="GetResults" DATASOURCE="Reminder">
> > SELECT * FROM customer
> > <cfif request = cat>order by category</cfif>
> > <cfif request = twn>order by town</cfif>
> > <cfif request = alpha>order by busname</cfif>
> > </CFQUERY>
> >
> >
> > Of course, this blows up! (CAT is Undefined...), even though debugging
> tell
> > me URL parameters request=cat. How am I supposed to pass a variable from
a
> > url to my sql query???
> >
> > Thanks in advance!
> >
> > Jeffrey
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists