Thanks sarah steve and adam
 
the cfif was the source of the last error now i have a new one.
 
it looks like the dob which i thought would be evaluated from the database selected record is not the case.
do i need to pass the dob vale from the form or from a query on the page.
 
I would like to use the between younger older compared to the value in the datase.
 
At this time i just pass a select vale for OlderThan and YoungerThan and now dob vale is sent to the query.
 
Is it possible to just send the 2 values and call the dob from the database?
and what format should the dob be in?
should it be Talent.DOB?
 
 
<cfset Form.OlderThan =5>
<cfset Form.YoungerThan =1>
<cfset form.search = "yes">
<cfset form.gender = "male">
<cfset form.hair = "">
 
<CFQUERY name="getRecord" dataSource="interact">
 SELECT  Talent.talentID , 
   Talent.Name ,
   Talent.Gender ,
   Talent.DOB ,
   Talent.Hair ,
   Talent.Eye ,
   Talent.Height ,
   Talent.Clothssize ,
   Talent.shoesize ,
   Talent.hobbies ,
   Talent.BIO ,
   Talent.Compcard ,
   Talent.ID
 FROM  Talent
 WHERE 1=1
 <CFIF ParameterExists(url.ID)>
 AND Talent.ID = #url.ID#
 </CFIF>
 
<CFIF ParameterExists(form.search)>
  AND Talent.gender = '#form.gender#'
  <!--- Check for age --->
  <!--- If we want an age range --->
  <CFIF Form.OlderThan AND Form.YoungerThan>
   AND dob BETWEEN DateAdd(Year,#Form.OlderThan#,dob) AND DateAdd(Year,#Form.YoungerThan#,dob)
  </cfif>
  <!--- If we want all people younger than an age --->
  <cfif Form.YoungerThan AND NOT Form.OlderThan>
   AND dob < DateAdd(Year,#Form.YoungerThan#,dob)
  </cfif>
  <!--- If we want all people older than an age --->
  <cfif NOT Form.YoungerThan AND Form.OlderThan>
   AND dob > DateAdd(Year,#Form.OlderThan#,dob)
  </cfif>

  
   <CFIF form.hair IS NOT "">
   and talent.hair = '#form.hair#'
   </CFIF>
  
  
</CFIF>
 
</CFQUERY>
 
regards greg
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to