When I create an article, and in the article there are punctuation marks (') / single quotes, my articles are not stored and disappeared. For example, in the words: I'm, Online's Story, Don't. Please Help Me Friends.
when executing a query with that kind of string use 'update table set columnOne = "'.mysql_real_escape_string($string) . '"'';
I do not understand, how to install the string above? Can you describe for me, friend? I have sintax as follows: function antislashes($data){ $filter = stripslashes($data); return $filter; } $content = antislashes ($_POST[content_textarea]); mysql_query("INSERT INTO article (title, content) VALUES ('$_POST[title]', '$content')"); mysql_query("UPDATE article SET content = '$content' WHERE id_article='$_POST[id]' ");
function antislashes($data){ $filter = stripslashes($data); return $filter; } $preContent = antislashes ($_POST[content_textarea]); $content = mysql_real_escape_string($preContent); mysql_query("INSERT INTO article (title, content) VALUES ('$_POST[title]', '$content')"); mysql_query("UPDATE article SET content = '$content' WHERE id_article='$_POST[id]' "); PHP: Try that.
mysql_real_escape_string($variable) should perfectly work fine. Always use mysql_error() function when doing some sql related work so that you dont waste much of your time trying to figure out where in your code it goes wrong when some unexpected error occurs withing your code.
Thank very much TimK, bartolay13, spaceman12. I actually got something very valuable here. Very perfect.