| | |
Cleaning up my code.
Please support our ColdFusion advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: May 2007
Posts: 1
Reputation:
Solved Threads: 0
Hi everyone. This is my first time here. I thank everyone for their help and support.
I don't have much of a problem but I have some code that I want to clean up and I'm fairly new at coldfusion. I believe there is a way I can clean up my code with respect to this one function I have and/or make the function run faster. I don't even know if it's actually a function but here it is:
So basically I have a table with a product number field. My overall desire was to append the product numbers to the 'itemlist' variable and then have each product number taken from another table based on the 'gifttype' and 'currency'.
Is there a faster way? If you need more information please let me know.
Thanks always.
I don't have much of a problem but I have some code that I want to clean up and I'm fairly new at coldfusion. I believe there is a way I can clean up my code with respect to this one function I have and/or make the function run faster. I don't even know if it's actually a function but here it is:
ColdFusion Syntax (Toggle Plain Text)
<!--- Set list of items to display for this category ---> <cfset getlist = ArrayNew(1)> <cfset str = ""> <cfset x = 1> <cfquery name="item" datasource="#request.dsn#"> select productnum from gift1to100 where gifttype = '#showlist#' and currency = #currency.currency_id#; </cfquery> <cfloop query="item"> <cfset getlist[x] = #item.productnum#> <cfif x eq item.recordcount> <cfset str = str & getlist[x]> <cfelse> <cfset str = str & getlist[x] & ","> </cfif> <cfset x = x + 1> </cfloop> <cfset itemlist = str> <!--- get items from db ---> <cfquery name="item" datasource="#request.dsn#"> select productdescription.product_name, product.description_id, product.product_no, productprice.price from product, productdescription, productprice where product.description_id = productdescription.description_id and product.product_no = productprice.product_no and productprice.currency_id = #currency.currency_id# and productprice.franchise_id = 0 and (product.product_no = 0<cfloop list="#itemlist#" index="i"> or product.product_no = #i#</cfloop>); </cfquery>
So basically I have a table with a product number field. My overall desire was to append the product numbers to the 'itemlist' variable and then have each product number taken from another table based on the 'gifttype' and 'currency'.
Is there a faster way? If you need more information please let me know.
Thanks always.
![]() |
Similar Threads
- First Post Here, Question about classes and constructors. (Java)
- So Lost writing this program... (C++)
- code optimization ... (C++)
- Average Word Length (Python)
- Form request help (ASP.NET)
- Spyware troubles even after cleaning / HT Log (Viruses, Spyware and other Nasties)
Other Threads in the ColdFusion Forum
- Previous Thread: Cfmail problem when sending to yahoo recipients
- Next Thread: Asynchronous CFML Gateway
| Thread Tools | Search this Thread |





