Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
CFRAM #1
Array Loop
Please help me to debug:
<cfquery name="qSelectPwd" datasource="#Application.AppDSN#">
select password from tablename
</cfquery>
<!--- Create List of passowrds and array --->
<cfset pwdlist = ValueList(qSelectPwd.password,",")>
<cfset pwdarray = ArrayNew(1)>
<cfset pwdarray = ListToArray(pwdlist,",")>
<cfloop index="i" from="1" to="#ArrayLen(pwdarray)#">
<cfoutput>#pwdarray#<br></cfoutput>
</cfloop>
<!--- The loop shows me different passwords. --->
<!--- Loop for the array of passwords and convert the passwords to new
passwords in the table --->
<cfloop index="i" from="1" to="#ArrayLen(pwdarray)#">
<cfquery name="qUpdate" datasource="#Application.AppDSN#">
Update TableName
Set password = '#Encrypt(pwdarray,Request.PasswordKey)#'
</cfquery>
</cfloop>
The loop updates the table with the First Password for all the records.
Thanks
CFRAM Guest
-
loop through array to build a new array
If I combine the following 2 functions (accesses by clicking a checkbox), as result the new array does not contains all items that matches the... -
cannot loop the array
I have 2 questions regarding arrays: 1) we need to define the size of the array, there is no dynamic array concept? i.e. the following define the... -
if/loop/array question
I'm trying to display an add or delete button dependent upon logged in user and I can't figure it out. Can someone please help with the... -
array data matches but array created in loop doesn't work
I have the exact same data in two arrays, but only the array created like so will work: $spaw_imglibs = array( array( 'value' =>... -
loop and write array
I'm having difficulty in trying to figure out a way to loop through a query and extract the info from a single column into an array. Here is what I... -
BSterner #2
Re: Array Loop
You're missing the 'where' clause in your update query. You need to qualify it
with something like...
Update TableName
Set password = '#Encrypt(pwdarray,Request.PasswordKey)#'
WHERE id =#id#;
You may be able to do this in a single SQL statement. I'm not a SQL expert,
but possibly someone else could suggest a way.
btw, isn't it throwing an error? You have...
Update TableName
Set password = '#Encrypt(pwdarray,Request.PasswordKey)#'
At the very least it should be...
Update TableName
Set password = '#Encrypt(pwdarray,Request.PasswordKey)#'
BSterner Guest
-
CFRAM #3
Re: Array Loop
I have resolved this. Instead of using the Array Loop I used the <CFLOOP Query="FirstQuery"> and It worked.
Thanks for the input.
CFRAM Guest



Reply With Quote

