Hi all, I have a strange problem. I could successfully insert apostrophe into MySql using mysql_real_escape_string. But when i try to read it to show in input text box it deosn't show. When i check it in database. It has full string with apostrophe. Code is : <input type=text name=lecture_name[] value=\''.$row[descr_text].'\'> can some one please give me a solution? Thanks in advance Smart
Are you also using addslashes as well as real_escape...? The other probably cause is magic_quotes_gpc is set on, causing the problem. Run the function echo get_magic_quotes_gpc(); and see what it returns.
hi Jestep, the function get_magic_quotes_gpc() returns 1. Still no idea how to solve this. Thank you for the reply.
You need to turn off magic_quotes or use stripslashes(). Right now, you most likely have slashes stored in the DB, so you probably need to go with the stripslashes method. For the future, I would turn off magic_quotes and manually use mysql_real_escape... and other sanitization methods. Here's a good description of why not to use magic quotes: http://arpad.co.uk/2008/09/the-adventure-of-php-and-the-magic-quotes/