Insert textarea datas in mysql, with " or '....

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I've a textarea and would like to save the content in a mysql table each
time a user click on a form.

How can I do for avoiding error when the user put a " or a ' in the message,
or any other character that may cause problems.

My query is:
"insert into questions(UserID,Question) values

The problem is with QUESTION, that may have a ' in it, or ".


Re: Insert textarea datas in mysql, with " or '....

"insert into questions(UserID,Question) values

this will work for single quotes and double quotes, but not for
`backquotes`. Most of the time I think people just shouldn't insert
backquotes :) So I normally just replace backquotes with single quotes
and the problem is solved:

"insert into questions(UserID,Question) values

not tested but should work :)

Bob Bedford wrote:
Quoted text here. Click to load it

Site Timeline