I'm trying to set up an advanced search on my site and I want to search
with parameters for how old a product is based on the Products table's
DateCreated field (a standard ColdFusion date/time object). The form
options for users to select are 'unlimited' - 10000 days, '90 days', '14
days', '7 days', and '3 days'.
Here's the code I'm trying and so far I'm getting the same results
whether I select a date or not. It doesn't appear to be processing any
date info:
<cfif ParameterExists(SearchLength)>
<cfif SearchLength IS NOT '10000'>
<cfif SearchLength IS '90'>
AND
#DateDiff(D,Now(),CreateODBCDate(Products.DateCreated))# < 90
<cfelseif SearchLength IS '14'>
AND
#DateDiff(D,Now(),CreateODBCDate(Products.DateCreated))# < 14
<cfelseif SearchLength IS '7'>
AND
#DateDiff(D,Now(),CreateODBCDate(Products.DateCreated))# < 7
<cfelseif SearchLength IS '3'>
AND
#DateDiff(D,Now(),CreateODBCDate(Products.DateCreated))# < 3
</cfif>
</cfif>
</cfif>
with parameters for how old a product is based on the Products table's
DateCreated field (a standard ColdFusion date/time object). The form
options for users to select are 'unlimited' - 10000 days, '90 days', '14
days', '7 days', and '3 days'.
Here's the code I'm trying and so far I'm getting the same results
whether I select a date or not. It doesn't appear to be processing any
date info:
<cfif ParameterExists(SearchLength)>
<cfif SearchLength IS NOT '10000'>
<cfif SearchLength IS '90'>
AND
#DateDiff(D,Now(),CreateODBCDate(Products.DateCreated))# < 90
<cfelseif SearchLength IS '14'>
AND
#DateDiff(D,Now(),CreateODBCDate(Products.DateCreated))# < 14
<cfelseif SearchLength IS '7'>
AND
#DateDiff(D,Now(),CreateODBCDate(Products.DateCreated))# < 7
<cfelseif SearchLength IS '3'>
AND
#DateDiff(D,Now(),CreateODBCDate(Products.DateCreated))# < 3
</cfif>
</cfif>
</cfif>