ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old October 18th, 2004, 01:41 PM
mikemac mikemac is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Location: Greenville NC
Posts: 70 mikemac User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 15 m 24 sec
Reputation Power: 4
Lightbulb ARRAY LIFE AND USING <CFLOOP>

What is the life of an Array. Lets say I declare and populate an array on one page then on the next page try to reference that array is it still "alive" or is it only valid on the page it is created???

Now can I use <CFLOOP> when inserting info in a database?
Here is an example of my code.....
<!---
<cfquery datasource="LearningCenter">
INSERT INTO QuestionList(Question)

VALUES(
<CFLOOP FROM="1" to="#SESSION.TestWiz.NumberOfQuest#" index="i">
<CFOUTPUT>'#quesList[i]#'</CFOUTPUT>
<CFIF quesList[i] LT #ArrayLen(quesList)#>
<CFOUTPUT>,</CFOUTPUT>
</CFIF>

</CFLOOP>
)
</cfquery>
--->

What do you think? Is this correct and is there a better way?

Reply With Quote
  #2  
Old October 18th, 2004, 03:08 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,627 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 10 h 8 m 55 sec
Reputation Power: 53
Any locally-scoped variable exists only for the duration of the current request. This applies to all variables, not just arrays. The only way to make it persist is to put it into a shared scope (session, application, or server), put it into the client scope, or pass it to the next page request using form or URL variables. Note that case of arrays (and all other complex data types), you must serialize the variable into a string (often via CFWDDX) before you can store it in the client scope or pass it as a form or URL value.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > ARRAY LIFE AND USING <CFLOOP>


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway