Script Garage

 

How do I allow single quotes in a php script?

I'm using php scripting to send text data to a MySql database. Everything is working great but I am unable to use single quote's in the text boxes. What statement needs to be made in my script? I think I have to do something like this: $string_escaped = addslashes(“string”); How do I add this to my script?

Public Comments

  1. Correct. "addslashes" will basically turn ' into \', as \ is the escape character.
  2. You should be able to escape the quotes with a backslash. "Here is \"quoted\" text."
Powered by Yahoo! Answers