Hi, I need help. I tried to pass a string to a URL parameter for my web service, however, it says that there's an error on the SQL Syntax.
I suspect this is because on my string that has a "double quote" value.
Example: Jhon's Madul"a
Anyone know how to handle this on LiveCode to prevent error on the SQL Syntax?
Thanks a lot.
SQL Query error when a String has double quote
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: SQL Query error when a String has double quote
Please post the code that is causing the error… more than likely this will be a simple fix.
-
- VIP Livecode Opensource Backer
- Posts: 137
- Joined: Wed Aug 26, 2009 7:42 pm
- Location: Randolph, MA USA
- Contact:
Re: SQL Query error when a String has double quote
There is a set of characters that need to be 'escaped' for mySQL. I can't find my code that I use for this, but things like cr, slash, quote, etc. I generalky use the "regex" or C-string model of escaped characters for mySQL, so cr becomes /n, slash becomes //, etc. If you are unfamilar with these you can look up mySQL reserved characters to see what they should be.
Paul Dupuis
Researchware, Inc.
Researchware, Inc.
-
- VIP Livecode Opensource Backer
- Posts: 9731
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: SQL Query error when a String has double quote
Paul and Stam are trying to convince you to solve your problem like an adult would.
But I ran into something like this many years ago, and solved it like a petulant child. I substituted ASCII 210 (or 211, I cannot now remember) for every quote constant at risk:
Looks the same, and those arcane chars do not likely require escapement.
Craig
But I ran into something like this many years ago, and solved it like a petulant child. I substituted ASCII 210 (or 211, I cannot now remember) for every quote constant at risk:
Code: Select all
replace quote with numToChar(210) in yourProblemSnippet
Craig