Thread: Coldfusion help
View Single Post
Old 04-14-2012, 07:21 PM   PM User | #2
Gjslick
Regular Coder

 
Join Date: Feb 2009
Location: NJ, USA
Posts: 476
Thanks: 2
Thanked 70 Times in 69 Posts
Gjslick will become famous soon enough
You have spaces in the column names in your query. You can't just have "first name", this confuses the query parser. That should be changed to either "firstName" or "first_name". A column name basically shouldn't have a space in it.

I highlighted the problems in red below:
Code:
<cfquery datasource="b1008321-access">
UPDATE Member
SET first name='# FORM.first_name#', last name='# FORM.last_name#', address='# FORM.address#', Town='# FORM.Town#', date joined='# FORM.date_joined#'
WHERE memberID = #memberID#
</cfquery>
I'd recommend losing the spaces, but if you *really* need to keep them, then you need to surround each column name that has spaces with square brackets in your query. For example, you could change your query to this: (with a little better formatting...)

Code:
<cfquery datasource="b1008321-access">
    UPDATE
        Member
    SET
        [first name] = '#FORM.first_name#',
        [last name] = '#FORM.last_name#',
        address = '#FORM.address#',
        Town = '#FORM.Town#',
        [date joined] = '#FORM.date_joined#'
    WHERE 
        memberID = #memberID#
</cfquery>

Last edited by Gjslick; 04-15-2012 at 06:17 PM.. Reason: Better formatting
Gjslick is offline   Reply With Quote