When you display data from a database you can use stripslashes() to remove any slashes used to escape certain characters (like " or ') and then you should use htmlentities() to convert the characters (" and ' among others) to html-safe characters.
First, solve the problem. Then, write the code.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
When asking for assistance give as much information about the problem as possible