I posted this before, but I have new info so I'd like to present it
more accurately (I hope).

I'm having problems in the WHERE statement of a query and if any of
my form variables are blank then it doesn't find the correct record.
I have a form with firstname,middlename,lastname,address.  To
determine whether there's already a record with that info BEFORE I
insert the information, I do a query:

<cfquery name="dup_check" datasource="ch">
       SELECT firstname,middlename,lastname,address FROM alumni_contacts
       WHERE firstname = '#Form.firstname#' AND middlename =
'#Form.middlename#' AND lastname = '#Form.lastname#' AND
address='#the_address#'
</cfquery>

If any of the form variables are left blank, the WHERE in the query
fails to find the record that already exists.

So, I thought well if it doesn't like blank fields, then check for
that and maybe set it to empty quotes ''.  But that doesn't seem to
help.  I do:

<cfif Trim(Form.address) EQ "">
       <cfset the_address=''>
<cfelse>
       <cfset the_address='#Form.address#'>
</cfif>

I really need help here and have wasted so much time on this.
thanks.

--
Daniel Kessler

Department of Public and Community Health
University of Maryland
Suite 2387 Valley Drive
College Park, MD  20742-2611
301-405-2545 Phone
www.phi.umd.edu
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to