SQL error on pasted text

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Zood
Posts: 37
Joined: Mon Apr 24, 2017 7:17 pm

SQL error on pasted text

Post by Zood » Wed Aug 22, 2018 11:08 am

Hey all

I've encountered a slight problem.
Each time I try to enter pasted text into my database I get an error:
"Syntax error: (The entire pasted text)"

All my pasted text is originally from e-mails I received so perhaps it is about unrecognised layout?
I did try to do the following:

Code: Select all

Set the htmltext of field "Text" to field "Text"
This I did in order to strip out any html-conversion, There is no need to keep the original layout from the email.

Any ideas on how to fix this?
Thanks in Advance!

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: SQL error on pasted text

Post by bangkok » Wed Aug 22, 2018 11:50 am

Thank you to provide the script that inserts/updates the data into your mysql database, otherwise we are blind.

Furthermore, an example of one of those failed queries would be useful.

Last but not least, do you remove.... quotes from the data ?

MaxV
Posts: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: SQL error on pasted text

Post by MaxV » Wed Aug 22, 2018 2:44 pm

to strip out html use this:

Code: Select all

put the text of field "text" into field "text"
Then you have to escape all apostrophes:

Code: Select all

 put the text of field "text" into temptext
put replaceText(temptext,"'","''") into temptext
set the text of field "text" to tempText


Now you can use a query
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Post Reply

Return to “Databases”