Apostrophe and UPDATE

2013-10-09 Thread Paul Foraker
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

Re: Apostrophe and UPDATE

2013-10-09 Thread stephen barncard
http://stackoverflow.com/questions/9596652/how-to-escape-apostrophe-in-mysql On Tue, Oct 8, 2013 at 11:37 PM, Paul Foraker p...@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.

Re: Apostrophe and UPDATE

2013-10-09 Thread Monte Goulding
On 09/10/2013, at 5:37 PM, Paul Foraker wrote: Any suggestions? Check your UPDATE syntax: http://www.w3schools.com/sql/sql_update.asp Cheers Monte -- M E R Goulding Software development services Bespoke application development for vertical markets mergExt - There's an external for that!

Re: Apostrophe and UPDATE

2013-10-09 Thread Paul Foraker
Stephen, escaping the single quote with another quote causes the same error, with the result showing \'\' instead of \'. I tried it with and without variable substitution. Monte, my UPDATE syntax was incorrect. Thanks! In case anyone else needs something like this, here's the code that worked:

Re: Apostrophe and UPDATE

2013-10-09 Thread stephen barncard
On Wed, Oct 9, 2013 at 12:55 AM, Paul Foraker paul.fora...@gmail.comwrote: Stephen, escaping the single quote with another quote causes the same error, with the result showing \'\' instead of \'. I tried it with and without variable substitution. thanks, Paul. This goes in my Script

Re: Apostrophe and UPDATE

2013-10-09 Thread Dr. Hawkins
On Tue, Oct 8, 2013 at 11:37 PM, Paul Foraker p...@whitefeather.com wrote: '(last_name,notes) VALUES (O\'Byrne, betting this won\'t work!) WHERE id=599' at line 1 You're using the wrong escape. Inside a string, you need a double single quote, not a backslash. It's worth keeping a preSql()

Re: Apostrophe and UPDATE

2013-10-09 Thread Peter Haworth
Don't need to escape anything when using the :1,:2,etc notation, but if you did, it would be ''' not \'. The update syntax is UPDATE tablename SET colname=:1 etc Pete lcSQL Software On Oct 9, 2013 3:55 AM, Paul Foraker paul.fora...@gmail.com wrote: Stephen, escaping the single quote with

Re: Apostrophe and UPDATE

2013-10-09 Thread Paul Foraker
On Wed, Oct 9, 2013 at 1:32 AM, stephen barncard stephenrevoluti...@barncard.com wrote: Stephen, escaping the single quote with another quote causes the same error, with the result showing \'\' instead of \'. I tried it with and without variable substitution. thanks, Paul. This goes

Re: Apostrophe and UPDATE

2013-10-09 Thread Paul Foraker
On Wed, Oct 9, 2013 at 7:02 AM, Dr. Hawkins doch...@gmail.com wrote: You're using the wrong escape. Inside a string, you need a double single quote, not a backslash. It's worth keeping a preSql() function around, like: function preSQL pSQL replace ' with '' in pSQL if pSQL is