[thelist] CF/SQL syntax error

rudy r937 at interlog.com
Thu Jun 7 16:14:17 CDT 2001


>  UPDATE phonebook
>   SET phonebook = '#form.phonebook#'
>     , areacode = '#form.areacode#'
>     , date = '#form.date#'
>     , id = #form.id#
>  WHERE phonebook.id=#form.id#

hi robin

the syntax error is undoubtedly caused by your use of "phonebook" as both
the name of the table and the name of a column

i betcha the column is "phoneno" or something

if that's not the problem, then maybe the syntax error is the "date"
column -- see below

note that in an UPDATE statement you do not need to set every column -- in
particular, you do not need to (re)set the id back to itself, which is what
happens when you single out only that particular row to update

also, there's no need to qualify the column in the where clause with the
table name if you don't have to

so try this --

  UPDATE phonebook
   SET phoneno = '#form.phoneno#'
     , areacode = '#form.areacode#'
     , date = '#form.date#'
  WHERE id=#form.id#

lastly, watch out for columns called "date" which is a reserved word in
many databases

and be careful about setting a date column to any old string entered into a
form field, most databases are touchy about the valid formats they will
accept

helps?


rudy






More information about the thelist mailing list