|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Hey folks
Hey there. Thx for your info so far. I'm almost done wrapping down the code for that sh*tty thing Here is wat i got NOW: This would be my SPEdit.cfm Code:
<cfquery name="getVorplan" datasource="DARVorplan"> SELECT * FROM Sendeplan ORDER BY Sendeplan.Order </cfquery> <cfquery name="Moderatoren" datasource="DAR"> SELECT DJName FROM Moderatoren WHERE Aktiv=TRUE </cfquery> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Sendeplan bearbeiten</title> </head> <body> <cfoutput> <CF_DOW Param="DOWFULL" Wotag=#id# VNAME="actWoTag"> <table border="1" class="lstUO"> <tr><th width="50" scope="col">Zeit</th> <th width="100" scope="col">#actWoTag#</th><th width="80" scope="col">Sendung</th></tr> <form name="form1" method="post" action="../login/SPProcess.cfm"> <cfloop index="loopcount" from="1" to="#getVorplan.recordcount#"> <tr> <td>#getvorPlan.Zeit[loopcount]#</td> <td> <cfset Moderator = StructNew()> <cfset Modi =#getVorplan[actWoTag]#> <select name="selModerator"> <cfloop index="AnzModi" from="1" to="#Moderatoren.recordcount#"> <option>#Moderatoren.DJName[AnzModi]#</option> </cfloop> <option>Night-Stream</option> <option>Ohne Moderation</option> <option Selected>#Modi[loopcount]#</option> </select> </td> <td> <cfset MArt=#getVorplan["Art"&actWoTag][loopcount]#> <select name="ModiArt"> <cfif MArt IS "T"><option selected>Thema</option> <option>Special</option> <option></option> <cfelseif MArt IS "S"><option selected>Special</option> <option>Thema</option> <option></option> <cfelseif MArt IS ""><option selected></option> <option>Thema</option> <option>Special</option> </cfif> </select> </td> </tr> </cfloop> </cfoutput> </table> Now i got a question regarding this part up there. I got one select box which will set in a <td> from 1 to .recordcount. So after all i got 9 select boxes in the finished output. Now i want to update the database with that information. What do i got to do? Right now i have this: Thats my application.cfm Code:
<cfquery name="getVorplan" datasource="DARVorplan"> SELECT * FROM Sendeplan ORDER BY Sendeplan.Order </cfquery> <cfloop index="VPU" from="1" to="#getVorplan.recordcount#"> <cfquery name="UpdateVorplan" datasource="DARVorplan"> UPDATE Sendeplan SET Montag = '#selModerator#' , ArtMontag = '#ModiArt#' </cfquery> </cfloop> But what it does, it writes all 9 select boxes in ONE Row, meaning: Instead of updating info like this: Zeit Montag ArtMontag 08-10 DJ1 Special 10-12 DJ2 Thema it gives me this: Zeit Montag 08-10 DJ1 DJ2 10-12 DJ1 DJ2 I know something is not running right, but how do i tell the update query which select box to take? Because that sucka only got one name.. makes it difficult for me to understand Already tried this here too: SET Montag = '#selModerator[VPU]#' , ArtMontag = '#ModiArt[VPU]#' because i need to get the index somehow.... but as soon as i put that in there i get this Error thats drivin' me nuts: You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members. The error occurred in ..\SPProcess.cfm: line 10 8 : <cfquery name="UpdateVorplan" datasource="DARVorplan"> 9 : UPDATE Sendeplan 10 : SET Montag = '#selModerator[VPU]#' , ArtMontag = '#ModiArt[VPU]#' 11 : </cfquery> 12 : </cfloop> Also added an attachment so you guys can see what the filled table created by cfloop looks like Well thx already for the help Hope somebody can help me out with this l8erz |
|
#2
|
|||
|
|||
|
small bug is fixed.... :) more to go ;)
Its me again
Now i got this far with my application.cfm File. This is the new code: Code:
<cfquery name="getVorplan" datasource="DARVorplan"> SELECT * FROM Sendeplan ORDER BY Sendeplan.Order </cfquery> <cfset Modi=listtoarray(selModerator,",")> <cfset MArt=listtoarray(ModiArt,",")> <cfloop index="VPU" from="1" to="#getVorplan.recordcount#"> <cfquery name="UpdateVorplan" datasource="DARVorplan"> UPDATE Sendeplan SET Montag = '#Modi[VPU]#' , ArtMontag = '#MArt[VPU]#' WHERE Sendeplan.Order = #VPU# </cfquery> </cfloop> now i finally get all the djs in the fields where they are supposed to go to and it works. So everything is nice and fancy up to the point where i want to change the Field Modi (in the main cfm file its a selectbox called ModiArt which gets converted to an array in the SPEdit.cfm with listtoarray) I get this kind of Error Message: The element at position 3 of dimension 1, of array variable "MART," cannot be found. The error occurred in ..\SPProcess.cfm: line 14 12 : <cfquery name="UpdateVorplan" datasource="DARVorplan"> 13 : UPDATE Sendeplan 14 : SET Montag = '#Modi[VPU]#' , ArtMontag = '#MArt[VPU]#' 15 : WHERE Sendeplan.Order = #VPU# 16 : </cfquery> Does anybody have an idea? Thanks already L8ers |
|
#3
|
|||
|
|||
|
Are you sure your 2 lists MArt and Modi have the same number of elements? Sounds to me like one list has more elements than the other and you are stepping out of bounds. Also, if there are the same number of elements, are some elements blank? CF skips blank elements in a list. (i.e. they are not even counted) So if you have a list:
Yesterday,Today,,Tomorrow You MIGHT think that this list has 4 elements. Nope, just 3 according to CF. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Update query problem including cfloop |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|