Hi all,
I'm having real issues with the UPDATE command on a MySQL database. I can connect to the db via a website and via a filemaker db via ODBC. The code I have for updating in livecode doesn't throw an error but nor does it update the database.
Here's the code:
answer gConnectionID
put "cemdata" into tTableName
put field "indexcd" into tindexcd
put field "surname" into tsurname
put field "firstname" into tfirstname
put field "datedied" into tdatedied
put field "section" into tsection
put field "gravenum" into tgravenum
put field "gravecol" into tgravecol
put field "graverow" into tgraverow
put field "dateborn" into tdateborn
put field "maiden" into tmaiden
put field "additional1" into tadditional1
put "UPDATE " & tTableName & " SET " && \
"surname = '" & tsurname & "'," && \
"firstname = '" & tfirstname & "'," && \
"datedied = '" & tdatedied & "'," && \
"section = '" & tsection & "'," && \
"gravenum = '" & tgravenum & "'," && \
"gravecol = '" & tgravecol & "'," && \
"graverow = '" & tgraverow & "'," && \
"dateborn = '" & tdateborn & "'," && \
"maiden = '" & tmaiden & "'," && \
"additional1 = '" & tadditional1 & "'," && \
"WHERE indexcd = '" & tindexcd & "'" \
into tSQLstatement
answer tSQLstatement
revExecuteSQL gConnectionID, tSQLstatement
The tSQLstatement comes out as well formed, no errors apparent but no update! Any ideas??
Thanks
Problems with UPDATE on a MySQL db
Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller
-
- Posts: 2
- Joined: Mon Nov 09, 2020 6:04 pm
Re: Problems with UPDATE on a MySQL db SOLVED!
Just one comma, no error but no action!!
Here's the last part of the statement:
"additional1 = '" & tadditional1 & "'," && \
"WHERE indexcd = '" & tindexcd & "'" \
The comma before the 'WHERE' was messing up the code. I removed the comma, all is now well. Just posting it here made me look more carefully at the code.
Here's the last part of the statement:
"additional1 = '" & tadditional1 & "'," && \
"WHERE indexcd = '" & tindexcd & "'" \
The comma before the 'WHERE' was messing up the code. I removed the comma, all is now well. Just posting it here made me look more carefully at the code.