Sorry for the long post and reposting ( did not figure out how to edit the previous post).
Here is the code having the issue:
47 : </cfquery>
48 : <cfloop query="x">
49 : <cfset storydate = '#dateformat(createdate(x.news_year,x.news_month,x.news_day), 'd mmmm yyyy')#'>
50 : <cfif #form.criteria# eq 'story'>
51 : <cfif #storydate# gte #fromdate# and #storydate# lte #todate#>
And here is the code at the beginning of this page:
<!--- CREATE DATES FOR THE FROM AND TO DATES ON SUBMIT PAGE --->
<cfif isdefined('form.fromyear')>
<cfset fromdate = #createdatetime(form.fromyear,form.frommonth,form.fromday,0,0,0)#>
<cfset todate = #createdatetime(form.toyear,form.tomonth,form.today,23,59,59)#>
</cfif>
Would you please advise me where to fix the problem? Thank you!
createdate(x.news_year,x.news_month,x.news_day) |
Like I mentioned, it sounds like your input contains an invalid month (ie outside the valid range of 1-12). Dump your query and check the news_month values. It sounds like one of them is invalid. and that is why you are getting the error.
<cfdump var="#x#">
Would you please advise me where to fix the problem? Thank you! |
If that is the problem, you need to fix the invalid data in your database table first. Then add some form validation to prevent those invalid values from occurring again.
Message was edited by: -==cfSearching==-