Cool beans - makes perfect sense with comments - I guess I'm just a CF
nerd cause I'd rather do this than the table join?

Thx,
Donna

On Thu, 7 Oct 2004 12:44:37 -0700, Charlie Griefer
<[EMAIL PROTECTED]> wrote:
> well, in a nutshell, your 3 queries were essentially the same.  Even
> what you were returning/outputting was the same (typeDesc).  Different
> names, but there's no reason not to name them the same.  The only real
> difference is the value of typeID, which I passed as a dynamic value.
>
> Here's the code with a few addt'l comments inline.
>
> <!---
> the query based on URL.prodID to return typeID.
> would preferrably change the SELECT * to only those fields (or field)
> that you need.
> also, used <cfqueryparam> because every time you don't use
> <cfqueryparam> a kitty cat dies.
> --->
> <cfquery name="rdDetails" datasource="#dsn#">
> SELECT *
> FROM tblProducts
> WHERE
> ProdID = <cfqueryparam value="#URL.prodID#" cfsqltype="cf_sql_integer">
> </cfquery>
>
> <!--- we're looking for typeIDs between 1 and 3 specifically...that's
> what this cfif is checking... --->
> <cfif (rdDetails.typeID GTE 1) AND (rdDetails.typeID LTE 3)>
> <!---
> we're between 1 and 3, so run the query below.
> same suggestion re: using the SELECT *... would suggest specify fields.
> used <cfqueryparam> again to save a kitty.
> --->
> <cfquery name="rsType" datasource="#dsn#">
> SELECT *
> FROM tblTypes
> WHERE
> typeID = <cfqueryparam value="#typeID#" cfsqltype="cf_sql_integer">
> </cfquery>
> <cfoutput query="rsType">
> #trim(typeDesc)# <!--- outputting our query data --->
> </cfoutput>
> <cfelse>
> <!--- we had a typeID other than 1,2 or 3...so include the
> defaultdetails.cfm template --->
> <cfinclude template="defaultdetails.cfm" />
> </cfif>
>
> --
> Charlie Griefer
>
> ================================================
> Marta was watching the football game with me when she said,
> "You know, most of these sports are based on the idea of one group
> protecting its territory from invasion by another group."
> "Yeah," I said, trying not to laugh. Girls are
> funny.________________________________
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to