I'm trying to write a query that returns results on a database query after a user enters any information for a contact by entering any of the following in the form page: Last Name City County Neighborhood hockey_fan (Select from List Yes/No) Soccer_fan (Select from List Yes/No) Baseball_Fan (Select from List Yes/No) Basketball_Fan (Select from List Yes/No)
The code that is generating errors: <cfquery name="contacts" datasource="cdb"> SELECT last_name, city, county, neighborhood, hockey_fan, soccer_fan, baseball_fan, basketball_fan FROM Contacts <CFIF last_name IS NOT ""> AND last_name LIKE '#last_name#' </CFIF> <cfif city IS NOT ""> AND city LIKE '#city#' </cfif> <cfif county IS NOT ""> AND county LIKE '#county#' </cfif> <cfif neighborhood IS NOT ""> AND neighborhood LIKE '#neighborhood#' </cfif> <cfif hockey_fan IS NOT ""> WHERE hockey_fan = 'YES' </cfif> <cfif soccer_fan IS NOT ""> WHERE soccer_fan = 'YES' </cfif> <cfif baseball_fan IS NOT ""> WHERE baseball_fan = 'YES' </cfif> <cfif hockey_fan IS NOT ""> WHERE hockey_fan = 'YES' </cfif> ORDER BY last_name </CFQUERY> I'm not sure why I can't seem to get a return when the user enters a last name of Smith, and YES to Hockey Fan and Yes to Baseball fan. Thanks for any help in advance, kent ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:15:1717 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
