1) Date is a reserved word.  If you can't change it, enclose it in
square brackets.
2) you have 2 columns specified (Events, Date) but in your <cfelse>
condition you're only inserting a single value.  You should have NULL,
NULL.

On 4/18/07, Steve LaBadie <[EMAIL PROTECTED]> wrote:
> I have added a date field to an admin panel and am having trouble getting it 
> to work properly.  In the error message it does show that the text and date 
> are passing, but am recieving an error with the CFIF.  Any thoughts would be 
> appreciated.
>
> Error says: "Error Executing Database Query" and "Syntax error in INSERT INTO"
>
> <cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
> <cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ 
> "frmAddEvents">
> <cfquery datasource="member_login">
> INSERT INTO Events (Events, Date)
> VALUES (
> <cfif IsDefined("FORM.Events") AND #FORM.Date# NEQ "">
> '#FORM.Events#', "#FORM.Date#"
> <cfelse>
> NULL
> </cfif>
> )
> </cfquery>
> <form action="<cfoutput>#CurrentPage#</cfoutput>" method="post" 
> name="frmEvents" id="frmAddEvents">
> <input type="text" name="date" id="date" size="15" maxlength="10" 
> class="formveld" />
> <textarea name="events" cols="70" rows="10" id="events" 
> class="formveld"></textarea>
> <input name="Reset" type="reset" id="Reset" value=" Reset " class="formveld">
> <input name="Submit" type="submit" id="Submit" value=" Submit " 
> class="formveld">
> <input type="hidden" name="MM_InsertRecord" value="frmAddEvents">
> </form>
>
> Steve
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275789
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to