There needs to be a clearer understanding of what you are
trying to
accomplish. Your loop does not make any sense to me, no
matter which
way I try to twist my mind around it.
I presume that getDays is the name of the query, then your
loop is
trying to say something like this.
<cfloop from="10/23/2006" to "2/2/2007" index="x">
Note that those are strings, not date objects, so this makes
no sense.
It is basically equivalent to something like this.
<cfloop from="George" to "Robert" index="x">
So if you want to loop over the days between those two dates,
you will
need to convert them to dates and use some kind of date loop.
Something
I've done before:
<cfset loopDate = parseDate(getdays.startDate)>
<cfset endDate = parseDate(getdays.endDate)>
<cfloop condition="#dateCompare(loopDate,endDate,"d") GT
0#">
Do Stuff
<cfset LoopDate = dateAdd(LoopDate,"D",1)>
</cfloop>
Syntax not guaranteed, check documentation.
But all this would be based off only the first row of the
query. If you
are trying to do something with each row, you will need a
loop that
loops over the recordset.
DJ5MD wrote:
>
>
> I need help formatting an array to store the following
date ranges per room.
>
>
DATABASE Format
> Room StartDate EndDate
>
------------------------------------------------------------------------------
> Blue 10/23/2006 2/2/2007
> Green 10/25/2006 10/26/2006
> Yellow 11/2/2006 11/2/2006
> Yellow 11/10/2006 11/13/2007
>
> I am trying to use the following loop to get the ranges
for each room, but how
> then do I apply that to an array for each record of each
room and then append
> to the array.
>
> <cfloop from="#GetDays.StartDate#"
to="#GetDays.EndDate#" index="x">
> <cfoutput>#dateformat(x,
"MM/DD/YYYY")#</cfoutput><br>
> </cfloop>
>
> Thanks in advance for any help!!
>
>