Jump to content

Save Strings in SQL Database, how do i escape?


JJooeeyy

Recommended Posts

Hey guys,

i made a script, that saves strings that players wrote into a memo into a SQL Database.

i use the one that gets provided by mta, no addons.

now if there is a ' inside the string, it will output a debug and not save anything.

any ideas how to escape, or, if not possible, remove all ' (and other characters that make this not work) out of a string?

and if thats possible, could someone tell me which letters i have to take out?

Thank you very much

JJooeeyy

Link to comment

AWESOME, thx!!!

:D

Now i just need to know what other letters will cause problems :)

can i clear more then just 1 letter with i command? For excample taking out all / and ( ?

EDIT: Nevermind, just found out by myself :)

I'm gonna build a function :

function clearString (dirtystring)

clearedString = string.gsub(dirtystring, "'", "")

return clearedString

end

and send every string to it i need to get cleared :) so i can take out more letters if i want :-)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...