I'm making some kind of !msg bot where members can use !msg <username> <message_text> to send msg's to offline users and when the users join the channel they'll get there message..
I'm having a problem with adding messages that contain special characters to the mysql database...
"insert into msgs ( msgcontents ) values ('$message')" doesn't work when theres's a word like " he's " or " it's " in the $message ..
anyone know how to work around this so that those words with special chars can get added and retrieved normally ?
This all depends on the MySQL interface you are using.
Are you using a MySQL library for Tcl, or writting to a file, and sending it to the MySQL application?
Using a Tcl package is by far the most simple, and the best way about creating a fix. To do so, you should use the function provided, for escaping caracters.
For writting to a file (or direct to stdin on the mysql app), it would all depend how you handled the incoming text.
First, follow the rules for lists, as defined in the FAQ entry on the forum. If you can't work out how, you should paste the script, that is haviong trouble, and we can give pointers.
ok, found the function
had to use [mysqlescape $variable] .. but now a new problem has arisen :/
when I retrieve the text I put in the sql db back I get it like {he's bla bla bla bla} as a string.. with those {} :/
how can I msg that to a person without those {} ?
----
Hmm, I was trying some more stuff and apparantly found it:)
set something [mysqlnext $db]
[lindex $something 0] <- got me what I needed