>In regards to my question about duplicate entries and for your enjoyment >I present the following. > >I was looking at the tutorial on easycfm.com (easy for them to say) > ><cfquery name="DupCheck" datasource="myDSN"> > SELECT email > FROM tutorials > WHERE email = '#Form.email#' ></cfquery> > >But of course I want to check multiple fields. > >I wish to check firstname, lastname, emailaddress for duplicates. >The tutorial states "you can of course check multiple form values being >passed to your database." However I am so new to this I cannot envision >what the syntax might be. > >I started writing and got to this point. > > <cfquery name="DupCheck" datasource="#myDSN#"> > SELECT firstname, lastname, emailaddress > FROM 'addressbook' > WHERE firstname, lastname, emailaddress = '#Form.firstname#' > </cfquery> > >Am I getting close? I know that I want to do something different in the >last line of my SQL statement but I am not sure what. I need something >more on the right side of the equals sign and I may also be way off base >on the left side as well. In fact, I may be totally wrong about all of >this. Now stop laughing I really am this confused. > >Could you point out what I need here?
Close. Here's how to filter against multiple criteria: <cfquery name="DupCheck" datasource="#myDSN#"> SELECT firstname, lastname, emailaddress FROM addressbook WHERE firstname = '#form.firstname#' AND lastname = '#form.lastname#' AND emailaddress = '#form.emailaddress#' </cfquery> Just keep separating your criteria with the AND keyword and you can filter out as much as you want. Regards, Dave. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm

