That's correct.  A WHERE clause is illegal in an insert.  If by wrapping
the insert in a cfif statement you mean to do either an insert or an
update, that's correct.  You'll have some criteria to determine if you're
doing an insert or an update (often this will be if a record id is passed
to the template).  For example:

<cfif IsDefined("url.record_id")>
  <cfquery datasource="mydsn">
  UPDATE mytable
  SET this = '#form.this#',
      that = #form.that#
  WHERE record_id = #url.record_id#
  </cfquery>
<cfelse>
  <cfquery datasource="mydsn">
  INSERT INTO mytable (this, that)
  VALUES ('#form.this#', #form.that#)
  </cfquery>
</cfif>

Jim


-----Original Message-----
From: Lisa Greenberg <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Monday, July 03, 2000 12:28 PM
Subject: Re: What am I doing wrong?-solved


>
>--------------D82B2777473DE9569A6A5589
>Content-Type: text/plain; charset=us-ascii
>Content-Transfer-Encoding: 7bit
>
>I gather from your statement that it isn't legal to use a where clause.
One solution I thought of is to wrap this insert in a cfif  statement.
Thanks for your help
>
>--Lisa


------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to