Dealing with apostrophes

Dealing with apostrophes

90degreeturn90degreeturn Posts: 7Questions: 0Answers: 0
edited April 2010 in General
Hi!

What is the correct way to deal with apostrophes in datatables content?

I use jeditable to edit values in the table, but I cannot figure out how to do it.

Example:
1.) User input: 1234'5678
2.) value is saved as 1234\'5678 (because of the mysql_escape_string function that I use before writing to the database)
3.) in datatables.php (for the output to the datatable), I need to json_encode the value.
So it will now look like this: 1234\\'5678
3.) The output in datatables: 1234\'5678

The value saved in the database is 1234\'5678.
So datatables shows the correct value.

But I want to allow users to add single apostrophes. In php, I would simply use stripslashes() after I query the data from the database.
How do I do this with datatables (and without breaking the output)?

Replies

  • 90degreeturn90degreeturn Posts: 7Questions: 0Answers: 0
    Oh, I'm sorry.

    Magic_quotes_gpc was turned on in my php configuration.
    I turned it off and it now all works as intended. :-)
This discussion has been closed.