Apostrophe and UPDATE
stephenREVOLUTION2 at barncard.com
Wed Oct 9 08:44:56 CEST 2013
On Tue, Oct 8, 2013 at 11:37 PM, Paul Foraker <paul at whitefeather.com> wrote:
> While building a LiveCode front end to a MySQL database, I ran into the
> apostrophe-in-the-data problem. My friend "O'Byrne" cannot get updated.
> For INSERTs, the variable substitution method works great -- I can post
> O'Byrne's name as a new record.
> But, what should I do about UPDATE ?
> Here's my test code:
> on testUpdate
> global gCRMdbID
> put "last_name,notes" into tFields
> put fld "contact_id" into tID
> put fld "last_name" into tLastName
> put fld "notes" into tNotes
> put "UPDATE contact SET (" & tFields & ") VALUES (:1, :2)" & " WHERE
> id=" & tID into tSQL
> revExecuteSQL gCRMdbID, tSQL, "tLastName", "tNotes"
> if the result is NOT a number then
> answer error "There was a problem adding the record to the database:" &
> cr & the result as sheet
> exit to top
> end if
> end testUpdate
> ERROR MESSAGE in the result:
> You have an error in your SQL syntax; check the manual that corresponds to
> your MySQL server version for the right syntax to use near
> '(last_name,notes) VALUES ("O\'Byrne", "betting this won\'t work!") WHERE
> id=599' at line 1
> Any suggestions?
> -- Paul
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
San Francisco Ca. USA
more about sqb <http://www.google.com/profiles/sbarncar>
More information about the use-livecode