Hello,
i'm trying to send a encrypted string to my localhost database. The column in the table of course is a varbinary.
But this has some issues because it sees the string as a failure. its aes128 encrypted. encrypting and decrypting in the stack works ok.
Has anyone used mysql_real_escape_string like they use in php/mysql scripts? see https://secure.php.net/mysql_real_escape_string
It seems that using this would solve the problem, but is it usable in livecode?
i already used the info mentioned here: http://lessons.livecode.com/m/4071/l/70 ... l-database before so that's working ok.
Just the encrypted string gives some troubles.
Does anyone know how to get mysql_real_escape_string correct in this line:
put "INSERT INTO " & tTableName & " (" & tFields & ") VALUES (;1, :2)" into tSQL
many thanks for any help on this.
Sphere
how to get encrypted string into database
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 366
- Joined: Tue Apr 10, 2012 9:18 am
Re: how to get encrypted string into database
Do you know what characters are causing your problem? If so, you could just write your own function to escape certain characters.
I had some issue once where quotes were causing some problems in my sql, so I did this function:
and then use it like this:
I had some issue once where quotes were causing some problems in my sql, so I did this function:
Code: Select all
--this function escapes quotes out of strings to go to database.
function quoteEncode pString
put pString into tEncoded
replace quote with "\" & quote in tEncoded
replace CR with "\n" in tEncoded
return tEncoded
end quoteEncode
Code: Select all
--get your note and and encode it
put fld "note" into tNote
put quoteEncode(tNote) into tNote
Re: how to get encrypted string into database(solved)
Thanks ghettocottage for your reply,
maybe i can use that, but i don't know which character would cause the problem.
There are some strange ones used, but i can try your suggestion and see what it does.
this is the message i'm getting
****edit*** looking closely to the error message i saw the fault which slips in easy, before the 1 there you see ; and this should be :
(solved)
Thanks!
maybe i can use that, but i don't know which character would cause the problem.
There are some strange ones used, but i can try your suggestion and see what it does.
this is the message i'm getting
****edit*** looking closely to the error message i saw the fault which slips in easy, before the 1 there you see ; and this should be :
(solved)
Thanks!